UDP socket programming in C

UDP Socket Programming in C language

UDP socket programming in C Client-side program: #include<stdio.h> #include<stdlib.h> #include<sys/socket.h> #include<netinet/in.h> #include<string.h> #include<netdb.h> int main(int argc, char * argv[]) { int sockfd,bindfd,fromlen,n; struct sockaddr_in server, from; struct hostent *hp; char buff[50]; if(argc<3) { printf(“insufficient argument”); exit(1); } sockfd=socket(AF_INET,SOCK_DGRAM,0); if(sockfd<0) { printf(“could not create the socket.”); exit(1); } server.sin_family=AF_INET; server.sin_port=htons(atoi(argv[2])); hp=gethostbyname(argv[1]); memcpy((char*)hp->h_addr,(char *)&server.sin_addr.s_addr,hp->h_length); fromlen=sizeof(server); printf(“Enter the […]

Continue Reading
PHP tutorial in 2020

PHP beginner tutorials – zero to hero PHP course 2020

PHP beginner tutorials in 2020 | PHP beginner tutorials What is PHP? PHP beginner tutorials | PHP stands for Hypertext Preprocessor. PHP is a most powerful and widely-used open-source server-side scripting language. PHP scripting language is used to write dynamically generated web pages. PHP scripts are executed on the web servers and the final result […]

Continue Reading

Ascending and Descending order in C programming.

Program to sort array in ascending and Descending order using C programming. Sort array in ascending and descending order Hello friends, In this article we will learn to write program to sort array in ascending and descending order using C programming Language using bubble sort Program to sort array in ascending order in C #include<stdio.h> […]

Continue Reading