Sanniusignal is a completely free DLL Based on asynchronous socket. It encapsulates client, server, and UDP. With this DLL, you do not need to worry about heartbeat. Stick the package.
Group packages, sending files, and other complex tasks. You only need a few simple steps to implement a powerful communication system. It can help you feel the happiest thing and hope you can
Find out the deficiencies in the DLL in the Process of use; make corrections; the apple and Java versions of this DLL are under development ...... exchange QQ: 365368248; this demo source code: http://pan.baidu.com/s/1eQw1npw contains sanniusignal. DLL
The following describes how to use sanniusignal.
1): tcpserver. You can use the static txstart. startserver method to register the server itxserver. Then, you can set various properties through itxserver.
Itxserver. startengine (); you can go to the demo for details. It is relatively simple. Here are some notes.
1. itxserver. buffersize indicates the size of the received data buffer. The default value is 1 kb, which must be the same as that of the client. Otherwise, unpredictable data may occur.
The buffer size does not affect the size of data sent each time. The size can only increase the sending speed.
2. Determine whether the ipendpoint client is online before sending the itxserver. sendmessage. If the client is not online, no messages are generated. For example
If the message is sent successfully and the recipient has received the message, a successful sending event is triggered;
3. You can use itxserver. filelog to record the running information of the server;
2): The tcpclient client is successfully registered with the client itxclient through the static txstart. startclient (server address or URL, server port number) method.
The itxclient has various properties set. Finally, it starts itxclient. startengine (). It is similar to the server startup. You can go to the demo to see details. The client should pay attention
Fang
1. If the client is disconnected without being forced to shut down by the server, the client will be reconnected by default. The principle is that the client will be reconnected every 10 seconds.
If itxclient. reconnectmax times fail, the Client Engine is automatically disabled. During the reconnection, you can change the IP address and port number of the client to connect to the server.
If you do not want to reconnect when disconnected, you can set itxclient. reconnectmax = 0;
2: logon. Before the engine starts, you can set itxclient. outtime to set the timeout time. The default value is 10 seconds, that is, there will certainly be a logon result within 10 seconds.
; Logon successful or logon failed. A logon result event is triggered;
3): UDP engine, using the static method txstart. startudp () to register UDP-iudptx; then set various attributes through iudptx; and finally start
Iudptx. startengine (); if you want to bind a port number before starting, set iudptx. Port here; otherwise, use the local port randomly; whether it is UDP or server or
Clients; many of their methods, attributes, and events are the same, because they all inherit the basic interface itxbase of the communication system. The following is what the UDP engine should pay attention.
1. The advantage of UDP is that it is fast but unreliable. Therefore, some attributes cannot be set too much, such as iudptx. buffersize. The default value is 1 kb. If you send information on the wide area network,
The buffer size should not exceed the default value; otherwise, data will be lost. If the size of one-time data is greater than 1 kb, the system will automatically subpackage the data and will not packet loss.
4): The File Sending System uses the static filestart. startfilesend (ifilesendmust) method to generate a File Sending System ifilesend. Where ifilesendmust is
An interface that must be implemented. For details, refer to the demo. Then, set various attributes through ifilesend. The sending must be sent through the previous three engine systems. For example:
Itxclient. sendfile then a file tag is returned, which is an integer. ifilesend can operate on the tag to operate on the file being sent; receive the file
The same is true for the system. It also uses file tags. The same is true for file resume. The previous three communication engine systems also need to be used for resume. Because the file system cannot determine the user
Which communication system is used for resumable data transfer? For example, iudptx. continuefile can be used for resumable data transfer. You can also try again after the connection is dropped;
5): The file receiving system uses the static filestart. startfilereceive (ifilereceivemust) method to generate a file receiving system ifilereceive.
Ifilereceivemust is an interface that must be implemented by the receiver. For details, refer to the demo. Then, set various attributes through ifilereceive. The following describes how to pay attention to the file system.
Key Points
1. Each file has a file tag. The sending and receiving systems control the file by controlling the tag. If the file is transmitted in the same file, the tag is the same;
2. Pay attention to the buffer size of the buffersize attribute, which indicates the number of bytes transmitted at a time. The larger the File Buffer, the faster the transmission speed.
Debugging by yourself; TCP transmission can generally be set to relatively large, but udp should not exceed 1 kb; therefore, try not to use UDP as unreliable as possible for transmission of large files;
3. When files are interrupted due to various reasons such as the network, the file interruption event is triggered; the file is automatically in the paused sending or receiving status; the file is to be resumed; the reseller of the resume, if the other party
Agree to resume; the other party will not trigger the start method of resume; other people can find it through demo;
Summary:
In fact, this DLL is relatively simple; you only need to master these five interfaces; 1: itxserver TCP server interface 2: itxclient tcp client interface 3: iudptx
UDP interface 4: ifilesend file sender interface 5: ifilereceive file receiver interface the first three interfaces are started through txstart; the last two file Interfaces
Is started through filestart
Let's talk about this first today. I hope this dll will be helpful to you. If you have any shortcomings, I hope you can communicate with us through QQ or blog. Thank you.
This demo source code: http://pan.baidu.com/s/1eQw1npw contains sanniusignal. dll