my httpclient setConnectiontimeout=5000ms, if uri is valid but path is invalid, establish tcp connection will fail immediately with response code 404,rather than wait 5 seconds, why?
Setconnectiontimeout is for establishing TCP connection with host IP. if URI is valid and if connection could be established, this timeout wont apply further.
Server will return 404 immediately, if path invalid, and there is no timeout option.
Related
I use PHP WebSockets.
I've set a long timeout on the server:
protected function connected ($user) {
socket_set_option($user->socket, SOL_SOCKET, SO_RCVTIMEO, array('sec'=>7200, 'usec'=>0));
socket_set_option($user->socket, SOL_SOCKET, SO_SNDTIMEO, array('sec'=>7200, 'usec'=>0));
}
Nevertheless Firefox disconnects after about 5 minutes. I strongly suspect that this is because a timeout in Firefox.
What is the exact value of the timeout? How my JaveScript can access it? Can I change it?
The same applies to Chrome.
What you are setting with SO_RCVTIMEO & SO_SNDTIMEO is the timeout for socket send and recv. If within the set time, the send and recv do not perform their actions, error is returned.Its not related to the disconnect you are seeing
The disconnect that you see is probably due to inactivity on the TCP connection. Either the client or the server is setting up a idle line timeout of 5 minutes. May be you should setup application level keep-alive messages to keep the TCP connection intact.
Connect to AOL's mail server:
telnet mailin-01.mx.aol.com 25
You receive:
554- (RTR:DU) https://postmaster.aol.com/error-codes#554rtrdu
554 Connecting IP: 82.xxx.xxx.xxx
Connection to host lost.
Interestingly, the line breaks after the first two lines are <CR><CR><LF>. This is not visible in the telnet output. I determined this using a C# program that prints the bytes.
This appears to be invalid SMTP behavior. Is it? How to deal with that when writing an SMTP client?
(I understand the reason for the error code. The question is not about that but about the apparent protocol violation.)
I am trying to start sync_gateway from cmd with following command:
sync_gateway -url http://75.76.221.21:8091
I received following error:
20:33:23.014229 WARNING: Error installing Couchbase design doc: Put
http://192.168.2.102:8092/sync_gateway/_design/sync_gateway: dial tcp
192.168.2.102:8092: ConnectEx tcp: A connection attempt failed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to
respond. -- db.installViews() at database.go:29120:33:44.055739
WARNING: Error installing Couchbase design doc: Put
http:/_design/sync_housekeeping: dial tcp 192.168.2.102:8092:
ConnectExtcp: A connection attempt failed because the connected party
did not properly respond after a period of time, or established
connection failed because connected host has failed to respond. --
db.installViews() at database.go:30520:33:44.055739
FATAL: Error opening database: Put
192.168.2.102:8092/omnibazaar/_design/sync_housekeeping: dial tcp 192.168.2.102:8092: ConnectEx tcp: A connection attempt failed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to
respond. -- rest.RunServer() at config.go:415
How did you name your nodes in your Couchbase instance? If you look at the Server Nodes tab, is one of your nodes named "192.168.2.102". I see that from your sync gateway machine, you are trying to reach the Couchbase cluster using the 75.76.221.21 address. Have you checked network connectivity, from your sync gateway machine, try "telnet 192.168.2.102 8092" and see if it connects.
One other thing, it is more common to start sync gateway by redirecting in a configuration file, you can find them in the examples directory. For instance "sync_gateway < examples/config-server.json"
It seems to me that the operation doesn't give any information to any participant. Closing the TCP connection by the client can be detected by the server just as well. And the client doesn't need any kind of acknowledgement after deciding to disconnect from the server and calling QUIT.
In flash, we can create a server socket with this:
protected var socket:ServerSocket = new ServerSocket();
protected function createServer():void
{
socket.bind(1234,"0.0.0.0");
socket.addEventListener(ServerSocketConnectEvent.CONNECT, clientConnectedHandler);
// start listening for connections
socket.listen();
}
With this, any flash application try to connect to the server socket with the port 1234 will get connected. How can I do verification on connection to make sure it is connected from my application before accepting the connection on server socket?
Thank you.
SockerServer instance will throw errors on failure:
RangeError — This error occurs when localPort is less than 0 or greater than 65535.
ArgumentError — This error occurs when localAddress is not a
syntactically well-formed IP address. IOError — when the socket
cannot be bound, such as when: the underlying network socket (IP and
port) is already in bound by another object or process. the
application is running under a user account that does not have the
privileges necessary to bind to the port. Privilege issues typically
occur when attempting to bind to well known ports (localPort < 1024)
this ServerSocket object is already bound. (Call close() before
binding to a different socket.) when localAddress is not a valid local
address.
You can use try..catch statements to handle those errors.
If those errors aren't thrown, opening port went successfully :)