[컴퓨터 공학]소켓프로그램을 이용한 서버/클라이언트 업로드
- 등록일 / 수정일
- 페이지 / 형식
- 자료평가
- 구매가격
- 2005.03.14 / 2019.12.24
- 10페이지 / zip (압축파일)
- 평가한 분이 없습니다. (구매금액의 3%지급)
- 2,000원
추천 연관자료
- 본문내용
-
//////////////////////////////////////////////////////////
// //
// fileclient.c 클라이언트 구현 부분 //
// //
//////////////////////////////////////////////////////////
//----------------------- 헤더 선언 부분 ----------------------
#include
#include
#include
#include
#include
#include
#include
#include
#include
//---------------------- 버퍼 크기 선언 ------------------------
#define BUFSIZE 1024
#define BUF 200
//-------------------- 함수 선언 부분 -----------------------
void error_handling(char *message); //error발생시 호출
//------------------ client 메인 함수 구현 ---------------------
int main(int argc, char **argv)
{
int fd; // 파일 디스크립터 변수
int sd; // 생성된 소켓 디스크립터 변수
char buf[BUFSIZE]; // 파일의 내용을 담을 변수선언
char filename[BUF]; // 파일명을 담을 변수 선언
char fileinfo[BUF]; // 파일명과 파일 사이즈 정보를 서버에 전송하기 위한 변수
int nByte;
int nwrittenByte;
int justwritten;
struct sockaddr_in serv_addr;
/* IPv4의 주소 체계를 나타내는 구조체
struct sockaddr_in{
sa_family_t sin_family; // 주소체계
uint16_t sin_port; // 16비트 TCP/UDP Port
struct in_addr sin_addr; // 32비트 IPv4 주소
char sin_zero[8]; // 사용되지 않음
};
struct in_addr{
unit32_t s_addr; // 32비트 IPv4 인터넷 주소
};
*/
struct stat statbuf; // 파일 정보를 가지고 있는 구조체
/*
struct stat{ short st_dev; // 파일값을 담고 있는 드라이버의 번호, 또는 장치파일 경우는 파일 핸들
short st_ino;
short st_mode; // 파일의 모드에 대한 비트 필드 값
short st_nlink; // 항상 1로 고정되어 있다.
int st_uid;
int st_gid;
short st_rdev;
long st_size; // 파일의 크기
long st_atime; // 파일이 수정된 최근 시간
long st_mtime; // st_atime과 같다.
long st_ctime; // st_atime과 같다.
}
자료평가
-
아직 평가한 내용이 없습니다.
회원 추천자료
- 정보처리기사 핵심 요약집
- KB국민카드 IT 최종 합격 자기소개서(자소서)
- [졸업프로젝트][컴퓨터공학] 실습실 관리 프로그램
- [객체지향프로그래밍 설계] MVC(Model-View-Controller) Model Architecture & Pattern Research 및 JSP2 사례 조사 및 구현
- [JAVA] JAVA(자바)의 특징과 JAVA(자바)를 이용한 인터넷강의, JAVA(자바)를 이용한 WBI구현, JAVA(자바)를 이용한 안전한 전자메일, JAVA(자바)를 이용한 인터넷검색로봇, JAVA(자바)를 이용한 로봇원격제어 분석