Please I just want to know how to use and how to control the sockets??? I have no idea....
Ill be so Pleased & gratefulfor any explanation!!!
and also if anyone knows a page in the web!!!
so thx in adv.![]()
love,
abyssphobia
This is a discussion on Sockets in C++ within the Networking/Device Communication forums, part of the General Programming Boards category; Please I just want to know how to use and how to control the sockets??? I have no idea .... ...
Please I just want to know how to use and how to control the sockets??? I have no idea....
Ill be so Pleased & gratefulfor any explanation!!!
and also if anyone knows a page in the web!!!
so thx in adv.![]()
love,
abyssphobia
Last edited by abyssphobia; 08-18-2004 at 03:51 PM.
Have I crossed the line?
You'll get more answers on this in the Networking/Device Communication forum (just so you know for any future posts). A moderator will most likely move this post in a little bit.
http://www.google.com/search?num=50&...al&btnG=Search
there's a list of tons of sites you can check out
well what I usually do is build a wraper class around the C sockets....
something like
Code:class tcp { private: int sockfd; struct sockaddr_in address; char buffer[1000]; public: tcp(char *,int); int send(char*,int) int receive(); ~tcp(); }; tcp::tcp(char *ip,int port) { sockfd=socket(AF_INET,SOCK_STREAM,0); if(sockfd==-1) { //some error handling return; } address.sin_family=AF_INET; address.sin_port=htons(port); address.sin_addr.s_addr=inet_addr(ip); memset(&(address.sin_zero),'\0',8); if((connect(sockfd,(struct sockaddr *)&address,sizeof(struct sockaddr)))==-1) { //some error handling return; } return; } tcp::~tcp() { close(sockfd); } int send(char *message,int length) { return send(sockfd,message,length); } int receive() { return receive(sockfd,buffer,1000); }
Actually you can build an abstract class which can be used by your other classes and make it more elegant with the functionality needed....
Last edited by vasanth; 08-18-2004 at 03:56 PM.