[Libwebsockets] Error 98 on binding port (Nios II)
simonemacc at gmail.com
Wed Apr 2 17:32:14 CEST 2014
Yeah... I've to make some changes to our webserver in order to use lws.
It's very old... it's Boa :-(((
2014-04-02 10:50 GMT-04:00 Andy Green <andy at warmcat.com>:
> On 04/02/2014 10:32 PM, Simone Maccanti wrote:
>> Ok, thanks Andy... I'm "experimenting" and I still have to understand
>> well how things works.
>> Oh... another thing: when the server is listening on a certain port, i
>> tried to make a connection using a very simple web page. I've found
>> several example on Internet, they are pretty much the same:
>> new WebSocket(serviceUrl, protocol), where serviceUrl =
>> 'ws://localhost:55554/' and protocol is 'dumb-increment-protocol' for
>> The connection is closed immediately. Of course if the port is already
>> in use, nobody can reply, but even after i use another port i've the
>> same result. I can only see some activity in Test-server only if i
>> connect the browser straight to that port: http://<ip_board>:55554, but
>> not if i use a js. So this means to me that the webserver we use doesn't
>> support websockets.
> It's not that simple to test in isolation, a real browser has security
> restrictions that the origin sent from the client connection for ws:// or
> wss:// has to be the same as where the html page came from.
> You can check in the browser's developer console for clues, if that's the
> issue it'll mention it there in Chrome anyway.
> That's why it's very convenient lws has a built-in webserver.
>> 2014-04-02 9:22 GMT-04:00 Andy Green <andy at warmcat.com
>> <mailto:andy at warmcat.com>>:
>> On 04/02/2014 09:12 PM, Simone Maccanti wrote:
>> Yep you are right.
>> #netstat shows the port 55554 still in status LISTEN... after i
>> the server, interesting.
>> If you exit the server normally and call the destroy context
>> callback, it should close the listen socket.
>> Even if you don't close it nicely, Linux shouldn't have the idea of
>> a socket open and listening with no owning process anyway, sounds
>> like it's some issue with uclinux.
>> TIME_WAIT is different, it's not listening and accepting new
>> connections like that.
>> 2014-04-01 18:39 GMT-04:00 Andy Green <andy at warmcat.com
>> <mailto:andy at warmcat.com>
>> <mailto:andy at warmcat.com <mailto:andy at warmcat.com>>>:
>> On 04/02/2014 04:24 AM, Simone Maccanti wrote:
>> Hello guys.
>> First of all thanks for this great library!
>> I'm trying to port libwebsockets to uCLinux (Board with
>> Nios II)
>> for use
>> Cool, this kind of platform is what I originally had in
>> mind for
>> very resource-constrained and unthreaded case for lws.
>> Websockets and speed up some data published by the
>> Board web
>> page... so
>> I'm doing some experiments. I've built the lib and
>> everything seems
>> fine, then i've build a simple server using
>> Test-server.c for try to
>> communicate to a simple web page.
>> The default port is the 55554 instead of 7681, but
>> every time i
>> the server (Test-server.c) libwebsocket_create_context
>> with error
>> 98 (bind: Address already in use). Starting the server
>> another port
>> (using the option --port) for example 55555, works.
>> The 55554 is not used of course and i can change it
>> with another
>> same results, it fails.
>> Seems an issue about how the socket is open and only
>> the first time.
>> Any idea?
>> If you look with netstat -pln after running and killing the
>> the first time, you may see the listen port in TIME_WAIT
>> state still.
>> lws changes the listen socket attribute to allow treading
>> on that
>> with a subsequent session listening on the same socket, but
>> it seems
>> that is broken on uclinux somehow.
>> Libwebsockets mailing list
>> Libwebsockets at ml.__libwebsocke__ts.org
>> <mailto:Libwebsockets at ml.__libwebsockets.org
>> <mailto:Libwebsockets at ml.libwebsockets.org>>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets