Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-06

fpwrite error

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lionel Drevon

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 i need to use the fpsetsockopt for the MSG_OOB+MSG_NOSIGNAL ? Perhaps some have an idea on how doing this?

Regards.

Reply by email

Unknown author
to Lionel Drevon
Lionel Drevon wrote 14 lines
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.

Reply by email