Networkcomms V3 support for TCP connections and UDP connections

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.