How to Send data from a UDP server to a client and back again


i have basic structure client server message system can't figure out how send messages server client. can please tell me how change can send data in forth between server , client.

client: http://pastebin.com/fzgcscbw

server: http://pastebin.com/k0n18qs0


- nathan hastings executive of interverse software

hi interverse software,

thank posting here.

as far know. when want send data server client. think have ip address , port. should send data client.

like this:

udpclient udpserver = new udpclient(udp_listen_port);  while (true) {     var remoteep = new ipendpoint(ipaddress.any, 11000);     var data = udpserver.receive(ref remoteep);     udpserver.send(new byte[] { 1 }, 1, remoteep); // if data received reply letting client know got data           }

here step:

server receive client message , echoed client.

 byte[] bytebuffer = client.receive(ref remoteipendpoint);           console.write("handling client @ " + remoteipendpoint + " - ");               // send echo packet client           client.send(bytebuffer, bytebuffer.length, remoteipendpoint);

i hope reply helpful you. if yes, please remember close thread marking useful posts answer.

your cooperation grateful.

best regards,

hart


we trying better understand customer views on social support experience, participation in interview project appreciated if have time. helping make community forums great place. click here participate survey.



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'