Tongda OA uses C # socket programming to replace the sample code share of the original operation

Source: Internet
Author: User
Tags php language
Access to OA in the use of PHP language for programming, as well as some of the IM operation is to use the socket way to communicate. A recent program needs to be done in C #, which involves this block, which is rewritten in C #, and requires further testing.

Using system;using system.collections.generic;using system.net;using system.net.sockets;using System.Text;using System.threading;namespace monitorflowworkandsubmit.dal{class Sendsocket {string myoa_tdim_addr = "127.0.0.        1 ";        int myoa_tdim_port = xxxx;                        public string Send () {String rst = "";            IPAddress IP = ipaddress.parse (MYOA_TDIM_ADDR); Socket clientsocket = new socket (AddressFamily.InterNetwork, Sockettype.dgram,prot            OCOLTYPE.UDP);                 try {clientsocket.connect (new IPEndPoint (IP, myoa_tdim_port));            Console.WriteLine ("conn OK"); } catch (Exception ex) {rst = "conn err!                "; Return ex.            ToString ();                 } try {string sendMessage = "X^a^admin";     Clientsocket.send (Encoding.ASCII.GetBytes (sendMessage));                       } catch {Clientsocket.shutdown (Socketshutdown.both);                 Clientsocket.close ();            Return "Send Error";        } return "OK"; }    }}
Related Article

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.