Re: socket already in use error on server

2013-06-19 Thread fatmck
forgot to mention, SO_REUSEADDR is not an option for me as I don't want two instances running at the same time. thanks Neeraj Date: Thu, 20 Jun 2013 09:58:55 +0800 From: fatmck mailto:fat...@163.com>> To: libev@lists.schmorp.de <mailto:libev@lists.schmorp.de> Subject: Re: socket alr

Re: socket already in use error on server

2013-06-19 Thread fatmck
you can google SO_REUSEADDR socket option. this option will allow you reuse the address. ? 2013?06?20? 09:54, Neeraj Rai ??: Hi, I am having trouble with my server restarts. If a client has connected, even if it later disconnects, the listener socket is put in TIME_WAIT state on shutdown. I

Re: libev epoll and EPOLLRDHUP

2013-06-13 Thread fatmck
After you accept a new connection, you must use ev_io_init() and ev_io_start() to start waiting read event on the new fd. By doing this, you can get a read event when the connection goes down. 于 2013年06月13日 14:24, Chaliha, Sayan 写道: Hi Marc, 1. I'm using Ubuntu 12.04 LTS (bare-bones kernel a

Re: C++ API

2012-05-04 Thread fatmck
于 2012年05月03日 21:27, Marc Lehmann 写道: On Thu, May 03, 2012 at 08:45:30AM +0800, 马承珂 wrote: Did you use the "-Wall" option? I just write a very easy sample code to test this on Ubuntu12.04 with g++4.6.3. You said you get it with -O2, and I disagreed, which apparently turned out to be true. -Wa

Re: 回复: Re: Should I use EV_WRITE event?

2011-11-24 Thread fatmck
send() function just copy the data to the send buffer of this socket. when send() returns a positive number, it does not means the data was really send to the network. Generally, if the send buffer is empty or your data is less than the space of send buffer, send() will always return success.

Re: the performance of server written by libev, when the client just do "connect" and "close"

2011-11-24 Thread fatmck
at 2011-11-24 16:38, debuguo said: My test result is not only slow but also strange. 0.4 second at the most of the time, but sometimes it would be 3 sec. I tried again, change loop count to a very big value, nowthe connect() blocked 3 sec sometimes. tcpdump shows somethings: 011-11-24 17:29:47

Re: the performance of server written by libev, when the client just do "connect" and "close"

2011-11-24 Thread fatmck
I cant explain why you test is so slow. But usually, we use socket in non-blocking mode. On server side, you should watch whether the listening socket is readable,. when it's readable, you can non-blocking accept(). On client side, you should watch write event on the connecting socket. when sock