arrives UDP datagram always the same size as they are sent in?
hey!
arrives udp datagram in same size sent in?
when there computer on internet send , thanks in advance!!
using system; using system.net; using system.net.sockets; namespace consoleapplication2 { class program { static void main(string[] args) { socket s = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); s.bind(new ipendpoint(ipaddress.any, 8000)); s.beginreceive(new byte[10], 0, 10, socketflags.none, new asynccallback(mef), s); console.readline(); s.close(); s.dispose(); } static void mef(iasyncresult r) { socket s = (socket) r.asyncstate; int = s.endreceive(r); if (a != 10) { // possible end here? console.writeline("noooo ! "); return; } s.beginreceive(new byte[10], 0, 10, socketflags.none, new asynccallback(mef), s); } } }
using system; using system.net; using system.net.sockets; namespace consoleapplication3 { class program { static void main(string[] args) { socket s = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); while(true) { s.sendto(new byte[10], new ipendpoint(ipaddress.loopback, 8000)); system.threading.thread.sleep(400); } } } }
it should because tcp sending , receiving end same size.
chanmm
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment