Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clinet/server interaction [2thumbsup]

Status
Not open for further replies.

vijraj

Programmer
Mar 14, 2007
11
US
Hi all!

1)How should I send bits or bytes to/from a server from/to a client in c language.

2)How should I make a connection on a socket from client to server?What is this Port id.
Is it already present or is it a number that we decide on.Please clarify my doubts.Thanks in advance.

vijraj.
 
Thank you.
But I have a fe questions about how to set that message I am sending via the network.
We agreed on a protocol to send data.
It goes something like this.The first bit is failure or success and next 4 bits are command that we need and so on and so forth and then the actual data.The data is in a char array buf;
So how should I set the individual bits .Should I use a char or something.
And if it is an integer I have to send along with other pieces then should I use the command htons() first and then append it to the string I am sending?
I am really confused.Please help me out.
I actually want to build up the message into a string and then use htonl. But I think I am wrong.
So any help is appreciated.
Thanks in Advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top