I'm writing a client-server app, in which the client has a determined memory address from the server side.
If something goes wrong and the server needs to be reestarted the address the client has is not valid anymore. When using a function using that invalid info a SIGSEGV will be sent to the server as the address may not be its anymore.
How can the server protect itself from a SIGSEGV and continue accepting connections and operating normally? Is there any way not to crash the server when this happens?
Thank you very much.
The client should not send a memory address to the server, period. If the client needs a reference to server resources, the server should provide it with some sort of handle that the server can translate to an address, but which isn't directly dereferenced.
In your case, the server restart has probably rendered the client's handle invalid. The server should notice this and return a well-understood error code to the client telling it to get a new resource handle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With