using WorldServer.Network; public class MyServer { private TcpServer server; public MyServer() { server = new TcpServer(); server.ConnectionAccepted += OnConnectionAccepted; server.Listen(1234); } private void OnConnectionAccepted(object sender, TcpConnectionEventArgs e) { // Handle the new connection } }
using WorldServer.Network; public class MyClient { private TcpClient client; public MyClient() { client = new TcpClient(); client.Connect("localhost", 1234); } public void SendData(byte[] data) { client.SendData(data); } }This code creates a TCP client and connects to the server on localhost port 1234. It also provides a method for sending data to the server. In both examples, the package library used is WorldServer.Network.