Reputation: 1598
I have a client implementation and a server implementation. I want the client to send data about itself along with its connection request to the server. So for example, I could send an additional packet with the username. I was wondering if this is at all possible using connect()
before a stream has actually been established. I would then accept only based on that information.
Thanks
Upvotes: 1
Views: 222
Reputation: 69260
Don't mix layers. The TCP connect
is on the network layer, establishing a communication channel between the machines.
Instead, define your protocol (the rules for how data is transmitted in your TCP stream) to contain a handshake first. E.g. SMTP uses a header and handshake to first set up the connection before any actual emails are sent.
Upvotes: 3