The Networkcomms V3 seamlessly supports both TCP and UDP connections.
You can easily create these two types of connections
// Create a connection information object New ConnectionInfo ("192.168.0.1"10000// Create a TCP connection Connection newtcpconn =// Create a UDP connection Connection newudpconn = Udpconnection.getconnection (Conninfo, Udpoptions.none);
A simple usage example:
//To specify the processing method for messages with the message type "Stringmessage"newconn.appendincomingpackethandler<string> ("Stringmessage", Methodtorunforstringmessage, networkcomms.defaultsendreceiveoptions); //methods to run when the connection is closedNewconn.appendshutdownhandler (methodtorunonconnectionclose);//send a custom object message type of "CustomObject1"Newconn.sendobject ("CustomObject1", CustomObject); //send a message with a message type of "CustomObject1", expecting the return message type "CusotmObject2"CustomObject2 customObject2 = Newconn.sendreceiveobject<customobject1, customobject2> ("CustomObject1", "CustomObject2", +, CustomObject); //Close ConnectionNewconn.closeconnection (false);
Original: http://www.networkcomms.net/tcp-udp-connections/
Www.networkcomms.cn Finishing
Networkcomms V3 support for TCP connections and UDP connections