Is there any suggested method for which program (socket server vs socket
client) should, preferably be started first?
Server. The client needs something to connect to -- if the server
isn't start, what will the client do? (Flip hamburgers?)
One of our software vendors asks of us as a matter of practice, that
anytime they need to bounce their socket server, I should also, after
their server has restarted, bounce the socket client connections. (They
inform us when this is necessary.)
By "bounce" do you mean restart? (In computer terms, "bounce" normally
means "reject" or "redirect" such as bouncing an e-mail that's directed
to an invalid e-mail address -- but you seem to be using it differently.)
Now that I have an iSeries RPG socket server program (thanks Scott
Klement), should I also consider the same process with my socket clients?
That really depends on how the software is written.
Normally, if you end a server, the TCP connection is closed, which means
that a FIN or RST packet is sent to the remote host (FIN for a nromal
close, RST for an abnormal close). This causes the remote side to get
an error telling them that the connection has closed, and they handle
the situation gracefully.
In the case where you can't send a packet (such as a power failure,
cable ripped out, router explodes, etc) the client program should have a
time-out mechanism so it doesn't sit there indefinitely.
So in a well-written software, the client should detect that it's no
longer connected to the server. Under some circumstances, it makes
sense for write code in the client that re-tries periodically until it's
reconnected -- in that case, you don't need to restart the clients when
the server is restarted, because it'd happen automatically.
It really depends on what the software does and how it's written.
Imagine a scenario where you've written an HTTP server that's available
to the public on the Internet. Everyone in the world can use it. If
you power-cycle it, should you call everyone in the world and tell them
to re-start their browsers? That sure doesn't seem practical!
It really depends on what you're doing. IMHO, in a perfect world,
software should be written so that it's never necessary to manually
restart something like this -- it should be coded for, and should happen
automatically. But, of course, the world isn't perfect.
The reason I ask is, during testing, the connectivity seems a bit flaky,
and I wonder if it's due to the client being connected indefinitely, while
we did end the socket server to do a system save, which afterwards did a
socket client restart.
That doesn't make sense to me. If you end your server, the client
shouldn't be able to stay connected. Therefore, it'll HAVE to be
restarted because it was disconnected. It won't just remain connected
and become flaky!
As an Amazon Associate we earn from qualifying purchases.