Im testing the async client/server example on MSDN. It works fine. The server example https://learn.microsoft.com/en-us/dotnet/framework/network-programming/asynchronous-server-socket-example, and the client example https://learn.microsoft.com/en-us/dotnet/framework/network-programming/asynchronous-client-socket-example
I'm trying to check if I can add some custom server "version" tag. So the client need to specify the version number in order to get a valid connection. It's not the default TCP Three Way Handshake I need. It's a extra custom version number added on the server and specified in the connection string on the client I am looking for.
Can I add some "version" object to the socket?
// Establish the remote endpoint for the socket.
// The name of the remote device is "host.contoso.com".
IPHostEntry ipHostInfo = Dns.GetHostEntry("localhost");
IPAddress ipAddress = ipHostInfo.AddressList[0];
IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
// Create a TCP/IP socket.
Socket client = new Socket(ipAddress.AddressFamily,
SocketType.Stream, ProtocolType.Tcp);
// Connect to the remote endpoint.
// TODO: How to add custom version object?
client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), client);