[fpc-pascal] fpwrite error

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Jun 21 09:01:33 CEST 2011



On Tue, 21 Jun 2011, Lionel Drevon wrote:

> Hello everybody,
> since i migrate to a 64bits hardware, i have compiled  a old source with the 
> last fpc 64 bits under linux.
> (due to an old 32 bits compiled software using in a 32 bits hardware, which 
> have the same beahaviour...)
>
> I'have got some times an error during an fpwrite to a socket. (so it's happen 
> some times...never when i test it with a telnet and it occurs 10% of 
> connexion...)
> The return shell error is 141 so it's seem to be for a  broken socket.
>
> How can freepascal handle this kind of problem?
> it appends just after this instruction=
> nb_emis:=fpwrite(client[i].csock,pp,serveur[i].buff_avail-serveur[i].buff_written);

Do you check that nb_emis is >= 0 ?

> Do i need to use the fpsetsockopt  for the MSG_OOB+MSG_NOSIGNAL ?

This is always a good idea, especially MSG_NOSIGNAL. If the other end breaks
the connection, you'll get a SIGPIPE signal, and the standard RTL does not
catch that signal, so you must catch it yourself.

Michael.



More information about the fpc-pascal mailing list