#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main(int argc, char **argv) {
int socket_desc; struct sockaddr_in address;
int addrlen;
int new_socket;
char *message=argv[1];
socket_desc=socket(AF_INET,SOCK_STREAM,0);
address.sin_family=AF_INET; address.sin_addr.s_addr=INADDR_ANY;
address.sin_port=htons(1000);
bind(socket_desc,(struct sockaddr *)&address,sizeof(address));
listen(socket_desc,3);
addrlen=sizeof(address);
new_socket=accept(socket_desc,(struct sockaddr *)&address,&addrlen);
printf("New socket at %d\n",new_socket);
send(new_socket,message,strlen(message),0);
puts("Message sent");
sleep(3);
close(socket_desc); }