소개글
프로젝트로 만든 소스 입니다.
확실하게 만든 소스기 때문에 A+ 받을실수 있습니다.
컴파일 실행환경
이 파일은 네트워트 프로그램 시간에
채팅 프로그램을 C언어로 짠 것입니다.
서버와 클라이언트로 나눠져 있습니다
클라인언트 부분 입니다.
본문내용
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <unistd.h>
#include <arpa/inet.h>
#define MAXLINE 1024
#define NAME_LEN 24
#define MAX_SOCK 64
int num_chat = 0;
int clisock_list[MAX_SOCK];
char clisock_list_name[MAX_SOCK][MAXLINE];
int num_room;
int name_nbyte;
int i, j;
struct room { // room structure
char room_name[MAXLINE];
char max_num[5]; // max entry
int num_room_cnt; // entry num
int cur_list[MAX_SOCK]; // entry name list
};
struct room rooms[MAXLINE];
int tcp_connect(int af,char *servip, unsigned short port);
void errquit(char *mesg) {
perror(mesg);
exit(1);
}
int tcp_connect(int af,char *servip, unsigned short port){ // tcp로 접속
struct sockaddr_in servaddr;
int s;
참고 자료
없음