开发者

Address already in use while executing C socket programme

Hii All,

While running a socket programme (server side ) am getting message like

Address already in use

Am trying to connect to port 80 since port 80 is reserved for https application So before running server side programme i am closing all application that uses https application ,is it enough... or am doing it wrong??

Am trying to make a communication between browser a开发者_开发问答nd termial...


You must run your application as super user(root) on Linux or administrator privileges on Windows in order to bind to port 80. This is the case for all service ports, which is < 1024. Either that or there still is another program binded to that port.

Try using netstat to find out what programs might be listening on port 80.

Example:

on Linux:

netstat -punta

on Windows:

netstat -ban

Both must be run with super user/admin privileges in order to see the program names that bind to specific ports.


If you just closed another process listening on 80 port, this port will be blocked for a certain timespan depending on your OS. This behavior is here to prevent an attacker to crash a service on your machine and immediately restart a malicious service on the same port.

This behavior can be disabled by using SO_REUSEADDR (by using setsockopt).

If your main problem is to communicate from a custom server to your broswer, you can use any port in your server for providing HTTP (8080 is common for that), just specify the port in the url http://server:port/ (ie. http://localhost:8080/)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜