bash - How to use nc send udp packet to windows 7? -


i need send udp packet consquently raspberry pi windows 7,in windows side,i use udpclient listen udp data ,that code :

        byte[] data = new byte[1024];         string input, stringdata;         udpclient server = new udpclient("127.0.0.1", 9050);          ipendpoint sender = new ipendpoint(ipaddress.any, 0);          while (true)         {             data = server.receive(ref sender);             stringdata = encoding.ascii.getstring(data, 0, data.length);             console.writeline(stringdata);         }         console.writeline("stopping client");         server.close(); 

and raspberry pi side,i want write bash script work ,but not know how, have done test,if type:

nc -vnzu 192.168.0.104 

the output :connection 192.168.0.104 9050 port [udp/*] succeeded!

and if type :

 nc -4u -w1 192.168.0.104 9050 

there no output,it seems still no error.

if don't use nc,just type :

echo -n "hello" >/dev/udp/192.168.0.104/9050 

there no error message show,but in windows side ,the c# progeam above not show receive data

so,can tell me how ,best in bash script form,thank you.

most bash implementations don't have /dev/udp//dev/tcp support compiled in, may reason isn't working you.

assuming have them enabled: problem may firewall configuration issue on windows 7 side. check windows 7 firewall allowing inbound connections selected port (9050).


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -