Recent

Author Topic: [SOLVED] SocketError question  (Read 1667 times)

Blestan

  • Sr. Member
  • ****
  • Posts: 461
[SOLVED] SocketError question
« on: June 20, 2017, 06:54:39 pm »
hi!
maybe im missing something but i cannot get how to process sockets errors occuring in mutithreading app... the function SocketError returns the error code but does not specify the socket ... the documentations just says Last error occured but i cannot be sure that no other sockets occured in time elapsed between the last operation and the check of the socketerror function ... i.e i cannot determine witch socket failed...
any ideas?
« Last Edit: June 20, 2017, 09:03:52 pm by Blestan »
Speak postscript or die!
Translate to pdf and live!

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: SocketError question
« Reply #1 on: June 20, 2017, 08:07:57 pm »
maybe im missing something but i cannot get how to process sockets errors occuring in mutithreading app... the function SocketError returns the error code but does not specify the socket ... the documentations just says Last error occured but i cannot be sure that no other sockets occured in time elapsed between the last operation and the check of the socketerror function ... i.e i cannot determine witch socket failed...
any ideas?

You can only poll socketerror after a function returned failure. Socketerror is based on threadvars, and there is only one function active at the same time in threads.

Therefore, if you check every socket function for error returnvalue (usually -1) and check socketerror only if the function returned the error, you always know what call did it.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
SocketError question
« Reply #2 on: June 20, 2017, 08:45:22 pm »
ok if its threadvar then i know exctly witch socket returned the lasterror
thanks!
Speak postscript or die!
Translate to pdf and live!

 

TinyPortal © 2005-2018