AnTCP
TCP Client (C#) and Server (C++) Library with a focus on simplicity and performance
Install / Use
/learn @Jnnshschl/AnTCPREADME
AnTCP Client/Server
TCP Client (C#) and Server (C++) Library that I'll use in my projects, mainly the AmeisenBotX and its NavigationServer.
Usage Client
Create a new AnTcpClient with your IP and Port. 🚀
AnTcpClient client = new("127.0.0.1", 47110);
Call the Connect method. 🌐
client.Connect();
Call the send method to send data (example sends two integers, but any unmanaged variable can be used). 0x0 is the message type that needs to have a handler on the server side, more on that later. 📤
(int, int) data = (new Random().Next(1, 11), new Random().Next(1, 11));
AnTcpResponse response = client.Send((byte)0x0, data);
Convert the response to any unmanaged data type. 🔄
Console.WriteLine($">> Data: {response.As<int>()}");
Call the Disconnect method if you're done sending stuff. 🚪
client.Disconnect();
Usage Server
Create a new instance of the AnTcpServer with your IP and Port. 🛠️
AnTcpServer server("127.0.0.1", "47110");
Create a callback function that will be called when the server received a message with type 0x0. 📬
void AddCallback(ClientHandler* handler, const void* data, int size)
{
// the function is going to add the two integers and returns its result
int c = ((int*)data)[0] + ((int*)data)[1];
handler->SendData((char)0x0, &c, 4);
}
Add the Callback to the server. ➕
server.AddCallback((char)0x0, AddCallback);
Run the server. 🚀
server.Run();
Related Skills
node-connect
342.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.7kCommit, push, and open a PR
