Sorry, dude! About the language barrier --don't worry, I am English literate.
Anyhow, back to the topic.Yes, I didn't understand what you posted earlier.Please explain further.
I'll explain in more detail how sockets are created and used.
There are lots and lots of kinds of sockets in UNIX, which is why the socket() call is so complex, but we're only interested in TCP sockets so we can disregard a lot of that.
Server
Create the socket:
It doesn't have any address or port at this point. It just exists, kind of blank.
Describe the address and port we want the socket to have, and bind it to it:
This is also more complex than it needs to be since the bind() call can describe many different kinds of addresses. For TCP/IP, the family will always be AF_INET. INADDR_ANY is just the IP address 0.0.0.0; giving it this address tells the socket to respond on any IP addresses your machine offers. If we gave it the IP address of one particular interface, it would only respond on that interface. If we gave it an IP address the machine didn't have, it'd just fail to bind the socket. htonl() makes sure the bytes of the address are in the correct order. htons() does the same for the port.
Accept a connection on the socket:
The accept() call will wait until someone connects to the socket. When someone does, it gives you a new, seperate file handle you can send() and recv() with, and fills out a structure explaining where the connection came from, in this case, echoCIntAddr.
Client
The socket is created the same way.
But instead of bind(), we use connect():
Note how instead of INADDR_ANY like the server, we give it the server's actual IP address to connect to.
connect() doesn't create a new socket like accept() does, it converts the existing socket into one you can send() and recv() with.
Hello,
I actually try to make client-server program.
I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error :
I'm just using this simple code :
and I get the same error if I use :
If someone can help me,
Thanks (2 Replies)
my system is a stand alone system... i want to try doing socket porgramming..ihave heard that this is usually done during testing...
how can i do that....? (6 Replies)
Hello!:)
I'm trying to do some socket programming based on the following situation:
I have a directory service named Casino that will hold all the information regarding the gamers that will try to connect to it in order to play a game(for example (Blackjack).Once they make the login they are... (4 Replies)
Hello everyone, I am a newbie in UNIX/Linux socket programming. This is a class project that I had trouble with.
==================================================
I was trying to make “Keep-Alive” HTTP connections to the server in a tiny web crawler project. Here is the problem: when I tried... (0 Replies)
Hello Everyone
Iam working on tcp/ip programming.with some time interval server has to send data.client has to close the connection and to open the connection between the time interval.this is the scenario
when iam closing the connection in client side the connection terminates.how to... (1 Reply)
I am trying to read HTTP data from a socket. However, for the final set of data being read using read(), read blocks and the control doesnt come back for further processing. I tried using select, but it didn't work...
Any help would be greatly acknowledged.:) (2 Replies)
hi
am senthil
am developing a software to send and receive SMS using HTTP connection
first of all am forming a URL and sending that URL to a remote server using my Client Program
i send that url through Socket(using Send() Function)
if i send more than one URL one by one using the same... (0 Replies)
hi
am senthil
am developing a software to send and receive SMS using HTTP connection
first of all am forming a URL and sending that URL to a remote server using my Client Program
i send that url through Socket(using Send() Function)
if i send more than one URL one by one using the same... (4 Replies)