NetSocket
NetSocket copied to clipboard
A .Net or mono TCP client / server socket messaging library written in C#
NETSOCKET TCP CLIENT-SERVER SOCKET LIB
Library builds to NetSocket.dll Works in .Net 2.0+ and mono 2.6+
Allows binary messages to be sent from client to server and vice-versa. Messages are prefixed with a simple header to track messages boundaries and keep everything synchronized. Messages are sent asynchronously in the order they are queued. The library automatically handles errors and disconnection as well as other erratum associated with the built-in Socket class.
Includes demo applications TestNetClient and TestNetServer
The TestNetServer application simply listens for connections on port 3333 and automatically accepts the first clients that connect. Valid messages are logged and echoed back to the client.
The TestNetClient application can connect to the server and send text messages or files.
Enums: JLM.NetSocket.SocketState { Closed, Closing, Connected, Connecting, Listening }
Classes: JLM.NetSocket.NetSocketConnectedEventArgs Properties: IPAddress SourceIP
JLM.NetSocket.NetSocketDisconnectedEventArgs Properties: string Reason;
JLM.NetSocket.NetSockStateChangedEventArgs Properties: SocketState NewState SocketState PrevState
JLM.NetSocket.NetSockDataArrivalEventArgs Properties: byte[] Data
JLM.NetSocket.NetSockErrorReceivedEventArgs Properties: string Function Exception Exception
JLM.NetSocket.NetSockConnectionRequestEventArgs Properties: Socket Client
JLM.NetSocket.NetBase (abstract) Properties: SocketState State int LocalPort string[] LocalIP
Events:
Connected
Disconnected
StateChanged
DataArrived
ErrorReceived
Methods:
void Send(byte[] data)
void Close(string reason)
JLM.NetSocket.NetClient > NetBase Events: ConnectionRequested
Methods:
void Listen(int port)
void Accept(Socket client)
JLM.NetSocket.NetServer > NetBase Methods: void Connect(IPEndPoint server)
License: LGPL http://www.gnu.org/licenses/lgpl.html Copyright: 2011 Jeremy Messenger