linux network server (pthread)

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include <pthread.h>

void *do_thread(void *arg);

struct tharg
{
	struct sockaddr_in client_addr;
	int csock;
};

int main()
{
	int ssock,csock;
	int clen;
	struct sockaddr_in client_addr,server_addr;
	pthread_t tid;

	if((ssock=socket(AF_INET,SOCK_STREAM,0))<0)
	{
		perror("socket error:");
		exit(1);
	}
	clen=sizeof(client_addr);
	memset(&server_addr,0x00,sizeof(server_addr));
	server_addr.sin_family=AF_INET;
	server_addr.sin_addr.s_addr=htonl(INADDR_ANY);
	server_addr.sin_port=htons(1337);

	if(bind(ssock,(struct sockaddr *) &server_addr,sizeof(server_addr))<0)
	{
		perror("bind error:");
		exit(1);
	}

	if(listen(ssock,5)<0)
	{
		perror("listen error:");
		exit(1);
	}

	while(1)
	{
		csock=accept(ssock,(struct sockaddr *) &client_addr,&clen);
		struct tharg arg;
		arg.client_addr=client_addr;
		arg.csock=csock;

		if(pthread_create(&tid,NULL,do_thread,(void *)&arg)<0)
		{
			perror("thread create error:");
			exit(1);
		}
	}
	return 0;
}

void *do_thread(void *arg)
{
	int csock;
	pthread_t tid;
	char buf[256]={0,};
	tid=pthread_self();
	char addr[16];

	struct tharg args=*(struct tharg *)arg;
	csock=args.csock;
	sprintf(addr,"%s",inet_ntoa(args.client_addr.sin_addr));

	printf("new thread %x is created from (%s)\n",(unsigned int) tid,addr);

	while(read(csock,buf,255)>0)
	{
		if(strcmp(buf,"exit\x0d\x0a")==0)
		{
			write(csock,"bye!!\n",6);
			break;
		}
		if(write(csock,buf,strlen(buf))<=0)
		{
			perror("write error:");
			close(csock);
			pthread_exit(NULL);
		}
		memset(buf,0x00,sizeof(buf));
	}
	close(csock);
	printf("%x thread is end from (%s)\n",(unsigned int) tid,addr);
	pthread_exit(NULL);
}