I am developing in Visual Studio (Visual Basic 2008) for Windows 2003 servers. I am designing an application which must create and maintain a socket connection to a third party IP address and port. Then I need to be able to send a message to this server from a client app, whether it is a web page or a Windows form. The server can be either Web Service, or Windows Service, but I am not clear how to expose an event to let the server know I want to send a socket transmission or that I have received a socket transmission.
I understand that I will want to use BeginReceive and BeginSend events on the socket, but not how to expose these to the client app which will hopefully reside on another machine. I have looked at various samples, including <a href="http://msdn.microsoft.com/en-us/library/fx6588te.aspx
">this</a>, but the code seems to be ALL synchronous or ALL Asynchronous. I want to connect once and not disconnect between my client requests.
I'm not too worried about concurrent requests as this is a very low volume app and the individual message streams will have a token in them that uniquely identifies the stream of the messages. I do, however need to respond to periodic "handshakes" from the vendor at the other end of the socket.
This is essentially an ISO8583 client if anyone is familiar with the architecture. I have the messaging format fairly under control. I appreciate any thoughtful advice on the subject.