Skip to content

Instantly share code, notes, and snippets.

View Ayoush's full-sized avatar
:octocat:
If it's not gonna work,it is worth a try.

Ayoush Chourasia Ayoush

:octocat:
If it's not gonna work,it is worth a try.
  • Pune
View GitHub Profile
#include<stdio.h>
#include<stdlib.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sys/types.h>
int main(void)
{
char server_response[256]="you have reached the server";
int server_socket;
server_socket=socket(AF_INET,SOCK_STREAM,0);
#include<stdio.h>//for using printf and scanf function
#include<stdlib.h>//for using atoi() function
#include<sys/types.h>
#include<sys/socket.h>//API conatins function like connect socket send rev
#include<netinet/in.h>//contains the structure sockaddr_in
#include<string.h>//for memset
#include<fcntl.h>
#include<netdb.h>//for using structure hostnet and for getting the host by name
#define MAX_BUFF 1024
#include<stdio.h>
# :- ask the compiler to pre-process things written after it whether header file or macros before compiling the code
include : ask for inclusion of all the function in stdio header file 
<> : stdio.h header file will be searched in the standard compiler include path
"" : stdio.h header file will be searched in the compiler include path as well as in current directory