Link to home
Start Free TrialLog in
Avatar of satendrajain
satendrajain

asked on

Networking in C......How to

Hi friends,
      I have been working on C-language for a long time and this is for the first time, I have started working on creating an network based application in C. so friends please help me in getting started....

      I have gone through the previous comments of the experts, but this comment wont help me now.....

thanks
satendra
ASKER CERTIFIED SOLUTION
Avatar of adg080898
adg080898

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of havman56
havman56

i advice u to start writing socket programmes
if u r using MS VC++. try out the following code.   u should add ws2_32.lib in project settings.



#include<windows.h>
#include<winsock.h>
#include<stdio.h>

void main()
{
     WSADATA WSAData;  
     struct sockaddr_in  serv;
     char senddata[1000],aa[20];
     LPTSTR lpszSystemInfo1,lpszSystemInfo2;  

     WSAStartup (MAKEWORD(1,1), &WSAData);
     sockfd=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
     
     serv.sin_family=AF_INET;
     serv.sin_port=htons(3333);
     serv.sin_addr.s_addr=inet_addr("127.0.0.1");


     ret=connect(sockfd,(struct sockaddr*)&serv,sizeof(serv));

     ret=send(sockfd,senddata,lstrlen(senddata) + 1,0);

}
Nothing has happened on this question in more than 9 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
split points between adg and Getch.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer