sockets

Hai,
How cani declare socket and collect the data in a string varialbe.
Since i am new to this i am asking this.
Can we connect multiple port.
Thank you.

Hai Arun

Arun there are some built-in functions and structures available in C language to create and communicate through sockets. The recv function itself gets the recieved value from the socket in a string variable.here is a good links for you to learn the system programing, sockets and all.

Let me give you some more good sites in the due-course

Good luck to your start

Hey Arun
There is book called "Unix Network Programming " by richard stevans, which is very good on socket and network programming. if you seriously wanted to go for network programming , then read this book. :slight_smile:

see there is full documentation of this topic in the man pages .
still some guidelines
for creating a socket you require threee thing that is network layer protocol ,Transport layer protocol and flag.
generally a tcp-ip packet will look like this socket(PF_INET,SOCK_STREAM,0)
this will return a integer value as descriptor.
after creating socket you have to bind if it is a server side socket.
bind need to set some parameters (binding means giving a name to packet).in case of ip you will have to specify port no which is 16 bit and a network no or ip address.
so in short
functions you will be using will be
socket()->bind()->listen()->accept()->close()
in case of client side
socket()->connect()->close();

hi,Hey Arun

I have got all of the books that written by Stevans except the "Unix Network Programming",I haven't found this book in any bookstore nearby ,could you give a link to download a ebook version of this book.;->

big - Amazon.com has it & Barnes & Noble (if there is one near you ) also stocks it

arun... - go here and download Chapter 5 for examples. The Stevens book is the best source for socket examples overall, IMO.

http://www.advancedlinuxprogramming.com/alp-folder

Somethings I happened to find usefull myself :

This is a free guide "Beej's Guide to Network Programming Using Internet Sockets" :

http://www.ecst.csuchico.edu/~beej/guide/net/

I found this book on my hardrive to be rather good :

BSD_Sockets_Programming_from_a_Multi-Language_Perspective_(Charles_River-2004).chm

http://www.charlesriver.com/Books/BookDetail.aspx?productID=70637

Chapter 1 of the Charles River book is titled "Networking Overview" consequently, btw.
__