Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
How Do Sockets Work?!?!?!
I am working on an application now where I need to have some computers communicate using sockets. The main computer is running a PLC HMI software that has embedded within it VBA. Two other computers will need to communicate with it: (1) Computer "A" will need to connect to the main computer and pass a 30-character string on an interval of maybe once every 5 seconds, and (2) Computer "B" will need to receive a different 30-character string from the main computer on about the same frequency. Thus, I believe that what I refer to as the main computer will need to function as a "server" in the first application and "listen" for an incoming connection request from Computer "A" but then function as a "client" in the second case and "connect" to Computer "B". I found your product by using Yahoo's search engine.
I am a VBA intermediate programmer but a socket rookie. I am wondering if anyone out there can point me to an online tutorial or maybe a book reference explaining how sockets work in general. I mean, I am asking questions like: "When I am listening, does my code need to loop until something happens, and if so, what?" "Once connected, will a connection ever self-terminate or must I call a method to disconnect?" "What is the normal format for data being transferred?" "Is it best to connect, send data and then disconnect, or just remain connected continuing to look for new data to arrive?" "Does a socket control only work within a VB UserForm, or can it be created within a regular module? A Class Module?"
I am not really looking for code examples (because I think I can write them if I just understood the process -- in fact, I have already found several examples), rather a description of the process of how to connect as a client and how to listen as a server.
0 · ·