Sending different packets through sockets via /r/learnprogramming


Sending different packets through sockets

Let's say I'm making a simple client / server interaction in which the client needs to login (and thus provide correct information to the server) before being able to access the server to complete some other tasks.

The packets for the different tasks would indeed be different since the tasks themselves are different, but how would they look like?

Let's say a client needs to login, would its LoginPacket look something like:

{ <flag to notify the server that the type of packet is LOGIN>; <username>; <password>; } 

?

And then, I guess, the server would need to send back some sort of acknowledgement packet (how would that look like, as well?).

Submitted July 12, 2017 at 11:16AM by PM_ME_STEAMCODES_TY
via reddit http://ift.tt/2sQv1ti

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s