In one of my situations that has been working without a hitch for a few years I am doing the following sequence in connecting and disconnecting to a 70 different server type devices in turn in one 30 second interval. This runs 24/7.
My client app has three winsocks that cover all 72 servers connecting in rotation so I can have a slight delay between connecting, sending and closing so the server devices can fully connect before I send each one it's data then close it. 123 234 345 456 etc. Some servers are LAN to serial adapters that need a 100ms delay between connecting and sending data to work and some are PCs.
Lots of other things are happening in the client and server so I can use delays or wait loops or doevents.
Sequence at 300ms intervals say using an IP 100.100.100.100 and Server Local port 3000:-
1. Set Client local port to 1000
2. Connect to server 100.100.100.100, 3000
3. Send Data. (works fine)
4. Close connection
5. 1 second later repeat the 4 above steps
6. I get a hang followed by error message "Address in use".(Only if I redo step 1)
7. If I wait about 60 seconds I can reconnect using the first 3 steps
However if I never re-set the client local port to anything at all, the winsock reconnect works without delay but the Client local port naturally keeps increasing each time to probably 64k then eventually goes back to the beginning and so on.
This has not been any problem up to now but the network administrators want me to restrict each connection to one fixed local port in both directions for network security purposes. Previously their firewall appears to have been one way only and all ports back to the clients were opened but now they are looking at restricting these as well.
A. Can anybody shed light on if this security situation is valid ? Are they correct in what they say in it being a security risk ?
B. Is there a way to change the winsock settings so the Client local port can reconnect instantly using the same local client port ?
C. Or should I be using a different method altogether ?
My client app has three winsocks that cover all 72 servers connecting in rotation so I can have a slight delay between connecting, sending and closing so the server devices can fully connect before I send each one it's data then close it. 123 234 345 456 etc. Some servers are LAN to serial adapters that need a 100ms delay between connecting and sending data to work and some are PCs.
Lots of other things are happening in the client and server so I can use delays or wait loops or doevents.
Sequence at 300ms intervals say using an IP 100.100.100.100 and Server Local port 3000:-
1. Set Client local port to 1000
2. Connect to server 100.100.100.100, 3000
3. Send Data. (works fine)
4. Close connection
5. 1 second later repeat the 4 above steps
6. I get a hang followed by error message "Address in use".(Only if I redo step 1)
7. If I wait about 60 seconds I can reconnect using the first 3 steps
However if I never re-set the client local port to anything at all, the winsock reconnect works without delay but the Client local port naturally keeps increasing each time to probably 64k then eventually goes back to the beginning and so on.
This has not been any problem up to now but the network administrators want me to restrict each connection to one fixed local port in both directions for network security purposes. Previously their firewall appears to have been one way only and all ports back to the clients were opened but now they are looking at restricting these as well.
A. Can anybody shed light on if this security situation is valid ? Are they correct in what they say in it being a security risk ?
B. Is there a way to change the winsock settings so the Client local port can reconnect instantly using the same local client port ?
C. Or should I be using a different method altogether ?