Can you send and receive on the same port?

Can you send and receive on the same port?

You just have to send all your datagrams through your “listening” socket. If every node “listens” on the same port, it means every node owns a socket that is bound to that port. If you want datagrams sent from A to B to appear coming from this fixed port you have to send them through that socket.

Can one port have multiple sockets?

@premktiw: Yes, multiple client sockets can be bound to the same local IP/port pair at the same time, if they are connected to different server IP/Port pairs so the tuples of local+remote pairs are unique. And yes, it is possible for a client to have more than 64K concurrent connections total.

Can two services listen on the same port?

It is possible. You just have to bind on the right IP address/interface each service using the same port. Ports (be them UDP or TCP) have their own pool per IP address. You can listen on the same port if you change: IP address or protocol (UDP or TCP).

Can TCP and UDP use the same port?

Yes, you can use the same port number for both TCP and UDP. Many protocols already do this, for example DNS works on udp/53 and tcp/53.

Is it a good idea to block outgoing ports?

TL;DR – filtering outgoing is a good idea. At least close off outgoing connections to all the bad things you never use (telnet, R-commands, etc), and judiciously consider closing off others. As others have mentioned above, blocking outgoing ports will minimize what an attacker can after your machine has already been infected.

Do you have to let incoming requests out to port 80?

In your case you only have to let incoming requests to port 80. When a connection is established, the firewall will automatically let packets out back to the client’s port. You don’t need to create rules for that because the firewall knows.

Is it safe to block outgoing network traffic?

Unless you block all outgoing traffic other than a whitelist of legitimate websites you visit (and/or use a proxy that does whitelisting and security scanning), there’s little additional security to be gained from blocking all ports except 80/443. Well, blocking port 25 might be good to keep your network from being used to send spam.