Hi! Now that I've established a UDP P2P (peer-to-peer) connection with the remote device, I have to send data.
On a TCP connection (stream) I read the bytes of the file to send and send them on the stream. The fact that when looking at the sniffer, I see that the data is broken into packets doesn't interest me - it gets successfully to the device.
TCP: NetworkStream stream = tcpClient.GetStream(); if (stream.CanWrite) { stream.Write(sendMsg, 0, sendLen); PutMessageOnForm("TCP: sent param len = " + sendLen); } stream.Close();
Using UDP, I tried something similar, and I got an error when I looked at the sniffer file that the data length is too big for a packet. I guess I assumed that C# implementation of UDP would "know" how to break the data into packets.
UDP: udpClient =new UdpClient(udpLocalPort); udpClient.Send(sendMsg, sendLen, UDPremote); PutMessageOnForm("UDP: sent param len = " + sendLen + " to " + UDPremote.Address.ToString() +" on port " + UDPremote.Port.ToString()); udpClient.Close();
I'd appreciate any ideas about what the correct packet lengths should be and if C# can do it for me or do I have to break the data up manually. Thanks! MechiMechi
Thanks! I've seen this - I didn't really want to go down tot he socket level - but I guess i have no choice! MechiMechi
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.