I'm busy experimenting with TCP socket connnections. I have made a client SOCK_STREAM socket andi've got a few questions:

  • Is there any way that a streaming(TCP) socket can get data from another socket without having to connect to it?

  • Is it safer to have a socket that a client connects to send data, and another one that the client gets data from (the server sockets exchange data) instead of one up and down socket?

Because what i'm trying to do now is to set up a client socket that request data from a server socket. Then that server socket forwards data to a random other socket that sends the data to the client.

If you don't exactly know what I mean, i'm open to questions!

  • 1
    What exactly is your threat and why do you believe that what you are trying can mitigate it?
    – Philipp
    Mar 29, 2015 at 23:14

1 Answer 1


To answer the first question: no, it is not possible for one socket without connecting to it, unless you attack the IP layer underneath. In that case you don't have to talk about sockets anymore.

No, it is not safer to have a server socket connect back to the client. An attacker could send the server socket almost anywhere.

If you want to protect a socket, use TLS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .