networking - Understanding the process of receiving network packets -


i started learn linux networking , packets filtering. in iptables documentation stated that:

  1. if packet destined box, packet passes downwards in diagram, input chain. if passes this, any processes waiting packet receive it.

so, suppose there're 3 server apps on host. servers , b tcp servers, , c udp server. true, if receive udp packet, at ip level packet delivered apps a, b, c? or sockets of apps & b wouldn't receive packet @ all?

tcp servers , udp servers operate in different ways.

at 1 tcp server listen on given tcp port (corner cases ignored sake of simplicity). connection requests (encapsulated in ip packets) destined port "accepted" 1 process (more accurately, accepted process has file descriptor corresponding 1 listening endpoint). combination of [remote_address,remote_port] , [local_address,local_port] unique. tcp server doesn't receive "packets", receives stream of data doesn't have specific relationship underlying packets carry data (packet "boundaries" not directly visible receiving process). , tcp packet neither connection request nor associated existing connection discarded.

with udp, each udp datagram logically independent , may received multiple listening processes. is, more 1 process can bind same udp endpoint , receive datagrams sent it. typically, each datagram corresponds single ip packet though possible datagram broken multiple packets transmission.

so, in example: no, server listening tcp requests (a "tcp server") never receive udp packet. port namespaces tcp , udp separate.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -