Ubuntu Touch On Nexus4 Manual Install (手动安装) under Gentoo
How to tell your iPhone application that location services are required

How to detect whether socket is still connected...

tubo posted @ 2014年9月03日 16:15 in 未分类 , 864 阅读

From wget source code…

bool
test_socket_open (int sock)
{
  fd_set check_set;
  struct timeval to;
  int ret = 0;

  /* Check if we still have a valid (non-EOF) connection.  From Andrew
   * Maholski's code in the Unix Socket FAQ.  */

  FD_ZERO (&check_set);
  FD_SET (sock, &check_set);

  /* Wait one microsecond */
  to.tv_sec = 0;
  to.tv_usec = 1;

  ret = select (sock + 1, &check_set, NULL, NULL, &to);
#ifdef WINDOWS
/* gnulib select() converts blocking sockets to nonblocking in windows.
wget uses blocking sockets so we must convert them back to blocking
*/
  set_windows_fd_as_blocking_socket ( sock );
#endif

  if ( !ret )
    /* We got a timeout, it means we're still connected. */
    return true;
  else
    /* Read now would not wait, it means we have either pending data
       or EOF/error. */
    return false;
}

 

Alyssa 说:
2023年1月06日 03:18

There are a few ways to detect whether a socket is still connected. One way is to try sending data on the socket. If the socket is no longer connected, this will fail. Another homes for sale Newport Beach way is to try reading data from the socket. If the socket is no longer connected, this will also fail. Another way is to check the socket's status flag. This flag will be set if the socket is no longer connected.

meidir 说:
2023年1月13日 21:51

I like this post very much. I will definitely be back. Hope that I can go through more insightful posts then. Will likely be sharing your wisdom with all of my friends! 바카라사이트

sofoj46278 说:
2023年2月12日 21:48

As I web-site possessor I believe the content material here is rattling wonderful , appreciate it for your efforts. You should keep it up forever! Good Luck. 여우알바

 

 

==================

 

 

Thanks for some other magnificent article. The place else could anybody get that type of info in such an ideal method of writing? I’ve a presentation next week, and I’m on the look for such info. 二手mac

meidir 说:
2023年2月22日 05:53

Good – I should certainly say I’m impressed with your site. I had no trouble navigating through all the tabs as well as related information. It ended up being truly simple to access. Good job.. 여우알바


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter