TCP를 통해 간단한 채팅 프로그램을 작성
- 최초 등록일
- 2003.06.14
- 최종 저작일
- 2003.06
- 5페이지/ 한컴오피스
- 가격 1,000원
소개글
TCP 를이용해서 채팅 프로그램을 작성한 리포트 화일 입니다.
쉽게 이해 하실수 있으실껍니다.
이 소스 화일을 리눅스나 유닉스 환경에서 실행했습니다.
목차
없음
본문내용
TCPSERVER C 언어 프로그램 소스
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#define SERVER_PORT 1234
#define MESSAGE_SIZE 1024
void *Threadfunc(void*pThread);
int main( void )
{
int sockfd, tsd, cliLen, result;
struct sockaddr_in cliAddr, servAddr;
pthread_t trd;
char buf[MESSAGE_SIZE];
sockfd = socket( AF_INET, SOCK_STREAM, 0 );
if ( sockfd < 0 ) return -1;
servAddr.sin_family = AF_INET;
참고 자료
없음