I’m writing a program in C (on windows 32bit) that listening on a specific port. (using this guide)
The client connect in that way: “http://127.0.0.1:port/?param1=a¶m2=b…”
I (as a server) want to get all of the parameters he entered.
How can i do that?
The
bind()function does not receive the parameters, or for that matter anything the client is specifying regarding your communication; it merely binds to the port. Once a port is bound to and an active connection eventually gets established, your application protocol (HTTP presumably, in your case) takes over in the sense of deciding what data towrite()(or other higher level functions) to the port.With that in mind, your question has actually nothing at all to do with sockets in any way. Rather, it has to do with understanding the application protocol you’re using. I would suggest you either Google how to use the HTTP protocol, review one of the myriad open source HTTP libraries available, or for theat matter just printf() the input you receive from your client.