I am trying to convert my VB6 code to .NET. There is no longer the Winsock control that you drop on the form, per se, but I did find that there is a socket class as well as a UDP class. However, most help files and examples use either TCP or use multicasting when using UDP. I need something much simpler than that (just simple connectionless UDP messages) and am still a bit confused.
I have a VB6 status display program that talks to some microcontrollers (doing real-time process control). To keep communications simple, everything uses simple UDP messages to keep overhead low and to not allow network problems to hold up time-critical processes on the controller if there are any connection problems.
I simply want to asynchronously receive messages from the controllers (they have known IP addresses such as 10.10.1.x). I would also like to add the capability to asynchronously send messages without receiving one first (which I think should be no problem).
The VB6 version was quite simple. In the form load, I had something like this (the Winsock control was named "network" and the code below is not exact):
network.close
network.protocol = sckUDPProtocol
network.localPort = 1633 ' this was my selected port to listen to (any sender address was accepted)
network.bind 1633
in the network_DataArrival routine (to handle receiving of asynchronous data)
inData = network.GetData
network.RemoteHost = network.RemoteHostIP
network.SendData (message)
There was not much more than that other than decoding the messages and updating the display and recording a log file.
Thanks,
Dale
I have a VB6 status display program that talks to some microcontrollers (doing real-time process control). To keep communications simple, everything uses simple UDP messages to keep overhead low and to not allow network problems to hold up time-critical processes on the controller if there are any connection problems.
I simply want to asynchronously receive messages from the controllers (they have known IP addresses such as 10.10.1.x). I would also like to add the capability to asynchronously send messages without receiving one first (which I think should be no problem).
The VB6 version was quite simple. In the form load, I had something like this (the Winsock control was named "network" and the code below is not exact):
network.close
network.protocol = sckUDPProtocol
network.localPort = 1633 ' this was my selected port to listen to (any sender address was accepted)
network.bind 1633
in the network_DataArrival routine (to handle receiving of asynchronous data)
inData = network.GetData
network.RemoteHost = network.RemoteHostIP
network.SendData (message)
There was not much more than that other than decoding the messages and updating the display and recording a log file.
Thanks,
Dale