Sunday, February 12, 2012

Socket creation [ networks lab ]


Socket creation

#include<stdio.h>
#include<sys/types.h>
#include<stdlib.h>
#include<unistd.h>
#include<netinet/in.h>
int main()
{
 int sockd1;
 sockd1=socket(AF_INET,SOCK_STREAM,0);
 if(sockd1!=-1)
  {
   printf("Sockect was successfully created\n");
  }
 else
  {
   printf("socket was not created\n");
  }
 close(sockd1);
 return(0);

No comments:

Post a Comment