Menu

Server Code

Prateek Shrivastava

Writing a Server using EasySocket

1. Add reference to the EasySocket.dll in your project

2. Import the namespace
using SocketWrapper;

3. Create the EasySocket class object (per your required scope)
EasySocket MySocketObject;

4. Initialize the object (per your initialization methods)
MySocketObject= new EasySocket("MyIPAddressOrLocalhost", MyIntegerPort, SocketMode.Server, false);

5. Set Max possible Data Size (in bytes - default 1024)
MySocketObject.SetSocketOptions(SocketOption.SocketBuffer, 2048);

6. Handle the Events you are interested in
MySocketObject.DataReceived += new EasySocketDataEventHandler(socketObject_DataReceived);
MySocketObject.ClientConnected +=new EasySocketEventHandler(socketObject_ClientConnected);
MySocketObject.ClientDisconnected +=new EasySocketEventHandler(socketObject_ClientDisconnected);

7. Start Listening (Start Server)
MySocketObject.Start();

// See Just 7 Steps


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.