HAI. CAN HAZ STDIO? VISIBLE "Talk about anything related to programming right here!". KTHXBAI.
User avatar
By MhX
#386 There is a very easy to use Socket library that I use a lot on my projects. Its main classes are System.Net.Sockets.TcpClient and System.Net.Sockets.TcpListener.

These classes have 3 different types of methods. Synchronous, asynchronous (callback), and asynchronous (async/await).

Synchronous methods doesn't have any prefix or suffix. Example:
Code: Select All Codestring packet = Read();

Callback asynchronous have an Begin/End prefix accepts a method as an argument. Example:
Code: Select All Codeprivate void OnReceivedPacket(IAsyncResult res)
{
    string packet = socket.EndRead(res);
}

socket.BeginRead(OnReceivedPacket);

Async/await asynchonous have Async suffix. Example:
Code: Select All Codestring packet = await socket.ReadAsync();


You can use my C# PCL as a starting point for a client implementation. https://github.com/mhackerx/dpcl/tree/master/C%23

Karth123 Wrote:Twisted provides abstract classes, which you subclass, then you override the functions, e.g https://twistedmatrix.com/documents/cur ... eclient.py

There may be a library that does that, but I recommend doing one specifically for what you need.