Socket Set Timeout issue

Source: Internet
Author: User
 
  



IP can not be connected, to more than 20s will not return can not connect;
How to set the connection timeout, send timeout, return timeout

New people do not know how to use the score, but also please be generous to enlighten!! Thank you


Reply to discussion (solution)

Connection takes more than 20 seconds

Not in the manual?

Set $socket send timeout of 1 seconds, receive timeout of 3 seconds:

$socket = Socket_create (AF_INET,SOCK_STREAM,SOL_TCP);
Socket_set_option ($socket, Sol_socket,so_rcvtimeo,array ("SEC" =>1, "USEC" =>0));
Socket_set_option ($socket, Sol_socket,so_sndtimeo,array ("SEC" =>3, "USEC" =>0));

Set $socket send timeout of 1 seconds, receive timeout of 3 seconds:

$socket = Socket_create (AF_INET,SOCK_STREAM,SOL_TCP);
Socket_set_option ($socket, Sol_socket,so_rcvtimeo,array ("SEC" =>1, "USEC" =>0));
Socket_set_option ($socket, Sol_socket,so_sndtimeo,array ("SEC" =>3, "USEC" =>0));

Socket_connect ($socket, $address, $service _port) or Die ("could does connect with". $address); is usually the connection timeout, how to do the connection timeout??

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.