Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SO_REUSEPORT on linux

Tags:

linux

sockets

udp

I want to know if SO_REUSEPORT option is enabled in LINUX 2.6 or not ??

If I try to use it and compile my code I get following error

01.c:72: error: `SO_REUSEPORT' undeclared (first use in this function)
01.c:72: error: (Each undeclared identifier is reported only once
01.c:72: error: for each function it appears in.)

Using the above option I guess I can bind two different sockets to same IPADRESS and PORT NUMBER

like image 338
codingfreak Avatar asked Jul 16 '10 04:07

codingfreak


People also ask

What is So_reuseport?

SO_REUSEPORT is what most people would expect SO_REUSEADDR to be. Basically, SO_REUSEPORT allows you to bind an arbitrary number of sockets to exactly the same source address and port as long as all prior bound sockets also had SO_REUSEPORT set before they were bound.

What is socket options in Linux?

In addition to binding a socket to a local address or connecting it to a destination address, application programs need a method to control the socket. For example, when using protocols that use time out and retransmission, the application program may want to obtain or set the time-out parameters.

What is So_priority?

SO_PRIORITY Set the protocol-defined priority for all packets to be sent on this socket. Linux uses this value to order the networking queues: packets with a higher priority may be processed first depending on the selected device queueing discipline.

What is socket linger?

The linger structure maintains information about a specific socket that specifies how that socket should behave when data is queued to be sent and the closesocket function is called on the socket.


1 Answers

this options was done in kernel 3.9, see this git commit

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c617f398edd4db2b8567a28e899a88f8f574798d

like image 135
user2559936 Avatar answered Sep 20 '22 15:09

user2559936