C Programming

UDP Socket Programming in C language

UDP socket programming 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 value to …

UDP Socket Programming in C language Read More »

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> …

Ascending and Descending order in C programming. Read More »