À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾

Size: px
Start display at page:

Download "À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾"

Transcription

1 P a 02 r t Chapter 4 TCP Chapter 5 Chapter 6 UDP Chapter 7 Chapter 8 GUI

2 C h a p t e r 04 TCP

3 TCP TCP TCP [ 4 2] listen connect send accept recv send recv [ 4 1] PC Internet Explorer HTTP HTTP HTTP TCP TCP FTP TCP 90 91

4 1 [ 4 3] [ 4 6] TCP TCP [ 4 3] 9000 bind [ 4 4] TCP [ 4 5] TCP [ 4 6] TCP [ 4 7] 1 1 TCP #n 2 TCP [ 4 8] recv printf send fgets send recv printf

5 001 #include <winsock2.h> 002 #include <stdlib.h> 003 #include <stdio.h> #define BUFSIZE // 008 void err_quit(char *msg) 009 { 010 LPVOID lpmsgbuf; 011 FormatMessage( 012 FORMAT_MESSAGE_ALLOCATE_BUFFER 013 FORMAT_MESSAGE_FROM_SYSTEM, 014 NULL, WSAGetLastError(), 015 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 016 (LPTSTR)&lpMsgBuf, 0, NULL); 017 MessageBox(NULL, (LPCTSTR)lpMsgBuf, msg, MB_ICONERROR); 018 LocalFree(lpMsgBuf); 019 exit(-1); 020 } // 023 void err_display(char *msg) 024 { 025 LPVOID lpmsgbuf; 026 FormatMessage( 027 FORMAT_MESSAGE_ALLOCATE_BUFFER 028 FORMAT_MESSAGE_FROM_SYSTEM, 029 NULL, WSAGetLastError(), 030 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 031 (LPTSTR)&lpMsgBuf, 0, NULL); 032 printf("[%s] %s", msg, (LPCTSTR)lpMsgBuf); 033 LocalFree(lpMsgBuf); 034 } int main(int argc, char* argv[]) 037 { 038 int retval; // 041 WSADATA wsa; 042 if(wsastartup(makeword(2,2), &wsa)!= 0) 043 return -1; // socket() 046 SOCKET listen_sock = socket(af_inet, SOCK_STREAM, 0); 047 if(listen_sock == INVALID_SOCKET) err_quit("socket()"); // bind() 050 SOCKADDR_IN serveraddr; 051 ZeroMemory(&serveraddr, sizeof(serveraddr)); 052 serveraddr.sin_family = AF_INET; 053 serveraddr.sin_port = htons(9000); 054 serveraddr.sin_addr.s_addr = htonl(inaddr_any); 055 retval = bind(listen_sock, (SOCKADDR *)&serveraddr, sizeof(serveraddr)); 056 if(retval == SOCKET_ERROR) err_quit("bind()"); // listen() 059 retval = listen(listen_sock, SOMAXCONN); 060 if(retval == SOCKET_ERROR) err_quit("listen()"); // 063 SOCKET client_sock; 064 SOCKADDR_IN clientaddr; 065 int addrlen; 94 95

6 066 char buf[bufsize+1]; while(1){ 069 // accept() 070 addrlen = sizeof(clientaddr); 071 client_sock = accept(listen_sock, (SOCKADDR *) &clientaddr, &addrlen); 072 if(client_sock == INVALID_SOCKET){ 073 err_display("accept()"); 074 continue; 075 } 076 printf("\n[tcp ] :IP =%s, =%d\n", inet_ntoa(clientaddr.sin_addr), 077 ntohs(clientaddr.sin_port)); // 080 while(1){ 081 // 082 retval = recv(client_sock, buf, BUFSIZE, 0); 083 if(retval == SOCKET_ERROR){ 084 err_display("recv()"); 085 break; 086 } 087 else if(retval == 0) 088 break; // 091 buf[retval] = '\0'; 092 printf("[tcp/%s:%d] %s\n", inet_ntoa(clientaddr.sin_addr), 093 ntohs(clientaddr.sin_port), buf); // 096 retval = send(client_sock, buf, retval, 0); 097 if(retval == SOCKET_ERROR){ 098 err_display("send()"); 099 break; 100 } 101 } // closesocket() 104 closesocket(client_sock); 105 printf("[tcp ] : IP =%s, =%d\n", 106 inet_ntoa(clientaddr.sin_addr), ntohs(clientaddr.sin_port)); 107 } // closesocket() 110 closesocket(listen_sock); // 113 WSACleanup(); 114 return 0; 115 } 001 #include <winsock2.h> 002 #include <stdlib.h> 003 #include <stdio.h> #define BUFSIZE // 008 void err_quit(char *msg) 009 { 010 LPVOID lpmsgbuf; 011 FormatMessage( 012 FORMAT_MESSAGE_ALLOCATE_BUFFER 013 FORMAT_MESSAGE_FROM_SYSTEM, 014 NULL, WSAGetLastError(), 96 97

7 015 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 016 (LPTSTR)&lpMsgBuf, 0, NULL); 017 MessageBox(NULL, (LPCTSTR)lpMsgBuf, msg, MB_ICONERROR); 018 LocalFree(lpMsgBuf); 019 exit(-1); 020 } // 023 void err_display(char *msg) 024 { 025 LPVOID lpmsgbuf; 026 FormatMessage( 027 FORMAT_MESSAGE_ALLOCATE_BUFFER 028 FORMAT_MESSAGE_FROM_SYSTEM, 029 NULL, WSAGetLastError(), 030 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 031 (LPTSTR)&lpMsgBuf, 0, NULL); 032 printf("[%s] %s", msg, (LPCTSTR)lpMsgBuf); 033 LocalFree(lpMsgBuf); 034 } // 037 int recvn(socket s, char *buf, int len, int flags) 038 { 039 int received; 040 char *ptr = buf; 041 int left = len; while(left > 0){ 044 received = recv(s, ptr, left, flags); 045 if(received == SOCKET_ERROR) 046 return SOCKET_ERROR; 047 else if(received == 0) 048 break; 049 left -= received; 050 ptr += received; 051 } return (len - left); 054 } int main(int argc, char* argv[]) 057 { 058 int retval; // 061 WSADATA wsa; 062 if(wsastartup(makeword(2,2), &wsa)!= 0) 063 return -1; // socket() 066 SOCKET sock = socket(af_inet, SOCK_STREAM, 0); 067 if(sock == INVALID_SOCKET) err_quit("socket()"); // connect() 070 SOCKADDR_IN serveraddr; 071 serveraddr.sin_family = AF_INET; 072 serveraddr.sin_port = htons(9000); 073 serveraddr.sin_addr.s_addr = inet_addr(" "); 074 retval = connect(sock, (SOCKADDR *)&serveraddr, sizeof(serveraddr)); 075 if(retval == SOCKET_ERROR) err_quit("connect()"); // 078 char buf[bufsize+1]; 079 int len; // 082 while(1){ 083 // 084 ZeroMemory(buf, sizeof(buf)); 085 printf("\n[ ]"); 086 if(fgets(buf, BUFSIZE+1, stdin) == NULL) 087 break;

8 089 // '\n' 090 len = strlen(buf); 091 if(buf[len-1] == '\n') 092 buf[len-1] = '\0'; 093 if(strlen(buf) == 0) 094 break; // 097 retval = send(sock, buf, strlen(buf), 0); 098 if(retval == SOCKET_ERROR){ 099 err_display("send()"); 100 break; 101 } 102 printf("[tcp ] %d.\n", retval); // 105 retval = recvn(sock, buf, retval, 0); 106 if(retval == SOCKET_ERROR){ 107 err_display("recv()"); 108 break; 109 } 110 else if(retval == 0) 111 break; // 114 buf[retval] = '\0'; 115 printf("[tcp ] %d.\n", retval); 116 printf("[ ] %s\n", buf); 117 } // closesocket() 120 closesocket(sock); // 123 WSACleanup(); 124 return 0; 125 }

9

10 TCP 1 TCP IP [ 4 20] TCP IP 2 local IP remote IP TCP LISTENING ESTABLISHED

11 bind IP 1 TCP [ 4 21] socket bind IP listen TCP LISTENING accept IP send recv closesocket s int bind( SOCKET s, const struct sockaddr* name, int namelen ); IP name TCP IP SOCKADDR_IN IP namelen TCPServer bind 050 SOCKADDR_IN serveraddr; 051 ZeroMemory(&serveraddr, sizeof(serveraddr)); 052 serveraddr.sin_family = AF_INET; 053 serveraddr.sin_port = htons(9000); 054 serveraddr.sin_addr.s_addr = htonl(inaddr_any); 055 retval = bind(listen_sock, (SOCKADDR *)&serveraddr, sizeof(serveraddr)); 056 if(retval == SOCKET_ERROR) err_quit("bind()"); TCP socket closesocket send recv API ZeroMemory C memset 52 AF_INET htons

12 54 IP IP INADDR_ANY IP multihomed host INADDR_ANY bind SOCKADDR * listen TCP LISTENING int listen( SOCKET s, int backlog ); s bind IP backlog connection queue backlog SOMAXCONN SOCKADDR_IN serveraddr;... retval = bind(listen_sock, (SOCKADDR *)&serveraddr, sizeof(sockaddr_in)); TCPServer listen 059 retval = listen(listen_sock, SOMAXCONN); 060 if(retval == SOCKET_ERROR) err_quit("listen()"); SOCKADDR_IRDA serveraddr;... retval = bind(listen_sock, (SOCKADDR *)&serveraddr, sizeof(sockaddr_irda)); backlog listen SOCKADDR_IRDA serveraddr;... retval = bind(listen_sock, (SOCKADDR *)&serveraddr, sizeof(serveraddr)); accept IP IP IP

13 s SOCKET accept( SOCKET s, struct sockaddr* addr, int* addrlen ); addr accept addr IP addrlen addr accept addrlen accept wait state NT 2000 CPU 0 [ 4 22] accept TCPServer accept 062 // 063 SOCKET client_sock; 064 SOCKADDR_IN clientaddr; 065 int addrlen; while(1){ 069 // accept() 070 addrlen = sizeof(clientaddr); 071 client_sock = accept(listen_sock, (SOCKADDR *) &clientaddr, &addrlen); 072 if(client_sock == INVALID_SOCKET){ 073 err_display("accept()"); 074 continue; 075 } 076 printf("\n[tcp ] : IP =%s, =%d\n", 077 inet_ntoa(clientaddr.sin_addr), ntohs(clientaddr.sin_port)); // 080 while(1){ } // closesocket() 104 closesocket(client_sock); 105 printf("[tcp ] : IP =%s, =%d\n", 106 inet_ntoa(clientaddr.sin_addr), ntohs(clientaddr.sin_port)); 107 } 63 accept SOCKET 64 accept accept IP 65 accept

14 70 accept addrlen clientaddr accept err_display IP inet_ntoa ntohs 3 2 TCP [ 4 23] socket connect send recv closesocket accept send recv IP TCP socket closesocket send recv connect connect TCP int connect( SOCKET s, const struct sockaddr* name, int namelen );

15 s name IP namelen bind bind connect IP [ 4 24] TCP UDP 6 IP send buffer receive buffer socket buffer send recv TCPClient connect 070 SOCKADDR_IN serveraddr; 071 serveraddr.sin_family = AF_INET; 072 serveraddr.sin_port = htons(9000); 073 serveraddr.sin_addr.s_addr = inet_addr(" "); 074 retval = connect(sock, (SOCKADDR *)&serveraddr, sizeof(serveraddr)); 075 if(retval == SOCKET_ERROR) err_quit("connect()"); IP connect TCP TCP 3 send recv WSA* send TCP IP send send

16 s int send( SOCKET s, const char* buf, int len, int flags ); connected recv int recv( SOCKET s, char* buf, int len, int flags ); buf len flags send 0 MSG_DONTROUTE 7 SO_DONTROUTE MSG_OOB 9 send blocking send send len wait state len send send len Nonblocking 9 ioctlsocket send send 1 len send recv s connected buf len buf flags recv 0 MSG_PEEK MSG_OOB 9 recv MSG_PEEK recv recv len len closesocket TCP recv 0 recv 0 normal close = graceful close

17 recv len TCP recv recvn [ 4 25] 53 left 0 len 037 int recvn(socket s, char *buf, int len, int flags) 038 { 039 int received; 040 char *ptr = buf; 041 int left = len; while(left > 0){ 044 received = recv(s, ptr, left, flags); 045 if(received == SOCKET_ERROR) 046 return SOCKET_ERROR; 047 else if(received == 0) 048 break; 049 left -= received; 050 ptr += received; 051 } return (len - left); 054 } 37 recvn recv 39 recv 40 ptr ptr 41 left recv recv ptr left TCPClient send recv 078 char buf[bufsize+1]; 079 int len; while(1){ 083 // 084 ZeroMemory(buf, sizeof(buf)); 085 printf("\n[ ]"); 086 if(fgets(buf, BUFSIZE+1, stdin) == NULL) 087 break; // '\n' 090 len = strlen(buf); 091 if(buf[len-1] == '\n') 092 buf[len-1] = '\0'; 093 if(strlen(buf) == 0) 094 break; // 097 retval = send(sock, buf, strlen(buf), 0); 098 if(retval == SOCKET_ERROR){ 099 err_display("send()"); 100 break; 101 } 102 printf("[tcp ] %d.\n", retval);

18 // 105 retval = recvn(sock, buf, retval, 0); 106 if(retval == SOCKET_ERROR){ 107 err_display("recv()"); 108 break; 109 } 110 else if(retval == 0) 111 break; // 114 buf[retval] = '\0'; 115 printf("[tcp ] %d.\n", retval); 116 printf("[ ] %s\n", buf); 117 } 78 = fgets \n Enter send send strlen buf recvn recvn \0 TCPServer send recv client_sock accept 066 char buf[bufsize+1]; while(1){ 081 // 082 retval = recv(client_sock, buf, BUFSIZE, 0); 083 if(retval == SOCKET_ERROR){ 084 err_display("recv()"); 085 break; 086 } 087 else if(retval == 0) 088 break; // 091 buf[retval] = '\0'; 092 printf("[tcp/%s:%d] %s\n", inet_ntoa(clientaddr.sin_addr), 093 ntohs(clientaddr.sin_port), buf); // 096 retval = send(client_sock, buf, retval, 0); 097 if(retval == SOCKET_ERROR){ 098 err_display("send()"); 099 break; 100 } 101 } recv 0 SOCKET_ERROR recv recvn \ send

19 TCP TCP TCP 1 application level [ 4 26] struct DrawMessage1 { int x1, y1; // int x2, y2; // int width; // int color; // }; struct DrawMessage2 { int x1, y1; // int r; // int fillcolor; // int width; // int color; // };

20 struct DrawMessage1 { int type; // = LINE int x1, y1; // int x2, y2; // int width; // int color; // }; struct DrawMessage2 { int type; // = CIRCLE int x1, y1; // int r; // int fillcolor; // int width; // int color; // }; [ ] EOR EOR EOR EOR [ 4 27] recvn 2 TCP [ ] EOR End Of Record

21 member alignment sizeof msg 10 = [ 4 28] msg struct MyMessage { int a; // 4 char b; // 1 int c; // 4 char d; // 1 }; MyMessage msg; //... send(sock, (char *)&msg, sizeof(msg), 0); int a; // 4 char b; // 1 int c; // 4 char d; // 1 }; #pragma pack() // MyMessage msg; //... send(sock, (char *)&msg, sizeof(msg), 0); 10 #pragma pack msg [ 4 29] #pragma pack(1) // : 1 struct MyMessage {

22 3 TCP IP [ 4 32] #include <winsock2.h> 002 #include <stdlib.h> 003 #include <stdio.h> #define BUFSIZE // 008 void err_quit(char *msg) 009 { 010 LPVOID lpmsgbuf; 011 FormatMessage( 012 FORMAT_MESSAGE_ALLOCATE_BUFFER 013 FORMAT_MESSAGE_FROM_SYSTEM, 014 NULL, WSAGetLastError(), 015 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 016 (LPTSTR)&lpMsgBuf, 0, NULL); 017 MessageBox(NULL, (LPCTSTR)lpMsgBuf, msg, MB_ICONERROR); 018 LocalFree(lpMsgBuf); 019 exit(-1); 020 } // 023 void err_display(char *msg) 024 { 025 LPVOID lpmsgbuf; 026 FormatMessage( 027 FORMAT_MESSAGE_ALLOCATE_BUFFER 028 FORMAT_MESSAGE_FROM_SYSTEM, 029 NULL, WSAGetLastError(), 030 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 031 (LPTSTR)&lpMsgBuf, 0, NULL);

23 032 printf("[%s] %s", msg, (LPCTSTR)lpMsgBuf); 033 LocalFree(lpMsgBuf); 034 } int main(int argc, char* argv[]) 037 { 038 int retval; if(argc < 2){ 041 fprintf(stderr, "Usage: %s [FileName]\n", argv[0]); 042 return -1; 043 } // 046 WSADATA wsa; 047 if(wsastartup(makeword(2,2), &wsa)!= 0) 048 return -1; // socket() 051 SOCKET sock = socket(af_inet, SOCK_STREAM, 0); 052 if(sock == INVALID_SOCKET) err_quit("socket()"); // connect() 055 SOCKADDR_IN serveraddr; 056 serveraddr.sin_family = AF_INET; 057 serveraddr.sin_port = htons(9000); 058 serveraddr.sin_addr.s_addr = inet_addr(" "); 059 retval = connect(sock, (SOCKADDR *)&serveraddr, sizeof(serveraddr)); 060 if(retval == SOCKET_ERROR) err_quit("connect()"); // 063 FILE *fp = fopen(argv[1], "rb"); 064 if(fp == NULL){ 065 perror(" "); 066 return -1; 067 } // 070 char filename[256]; 071 ZeroMemory(filename, 256); 072 sprintf(filename, argv[1]); 073 retval = send(sock, filename, 256, 0); 074 if(retval == SOCKET_ERROR) err_quit("send()"); // 077 fseek(fp, 0, SEEK_END); 078 int totalbytes = ftell(fp); // 081 retval = send(sock, (char *)&totalbytes, sizeof(totalbytes), 0); 082 if(retval == SOCKET_ERROR) err_quit("send()"); // 085 char buf[bufsize]; 086 int numread; 087 int numtotal = 0; // 090 rewind(fp); // 091 while(1){ 092 numread = fread(buf, 1, BUFSIZE, fp); 093 if(numread > 0){ 094 retval = send(sock, buf, numread, 0); 095 if(retval == SOCKET_ERROR){ 096 err_display("send()"); 097 break; 098 } 099 numtotal += numread;

24 100 } 101 else if(numread == 0 && numtotal == totalbytes){ 102 printf("!: %d \n", numtotal); 103 break; 104 } 105 else{ 106 perror(" "); 107 break; 108 } 109 } 110 fclose(fp); // closesocket() 113 closesocket(sock); // 116 WSACleanup(); 117 return 0; 118 } 001 #include <winsock2.h> 002 #include <stdlib.h> 003 #include <stdio.h> #define BUFSIZE // 008 void err_quit(char *msg) 009 { 010 LPVOID lpmsgbuf; 011 FormatMessage( 012 FORMAT_MESSAGE_ALLOCATE_BUFFER 013 FORMAT_MESSAGE_FROM_SYSTEM, 014 NULL, WSAGetLastError(), 015 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 016 (LPTSTR)&lpMsgBuf, 0, NULL); 017 MessageBox(NULL, (LPCTSTR)lpMsgBuf, msg, MB_ICONERROR); 018 LocalFree(lpMsgBuf); 019 exit(-1); 020 } // 023 void err_display(char *msg) 024 { 025 LPVOID lpmsgbuf; 026 FormatMessage( 027 FORMAT_MESSAGE_ALLOCATE_BUFFER 028 FORMAT_MESSAGE_FROM_SYSTEM, 029 NULL, WSAGetLastError(), 030 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 031 (LPTSTR)&lpMsgBuf, 0, NULL); 032 printf("[%s] %s", msg, (LPCTSTR)lpMsgBuf); 033 LocalFree(lpMsgBuf); 034 } // 037 int recvn(socket s, char *buf, int len, int flags) 038 { 039 int received; 040 char *ptr = buf; 041 int left = len; while(left > 0){ 044 received = recv(s, ptr, left, flags); 045 if(received == SOCKET_ERROR) 046 return SOCKET_ERROR; 047 else if(received == 0) 048 break;

25 049 left -= received; 050 ptr += received; 051 } return (len - left); 054 } int main(int argc, char* argv[]) 057 { 058 int retval; // 061 WSADATA wsa; 062 if(wsastartup(makeword(2,2), &wsa)!= 0) 063 return -1; // socket() 066 SOCKET listen_sock = socket(af_inet, SOCK_STREAM, 0); 067 if(listen_sock == INVALID_SOCKET) err_quit("socket()"); // bind() 070 SOCKADDR_IN serveraddr; 071 ZeroMemory(&serveraddr, sizeof(serveraddr)); 072 serveraddr.sin_family = AF_INET; 073 serveraddr.sin_port = htons(9000); 074 serveraddr.sin_addr.s_addr = htonl(inaddr_any); 075 retval = bind(listen_sock, (SOCKADDR *)&serveraddr, sizeof(serveraddr)); 076 if(retval == SOCKET_ERROR) err_quit("bind()"); // listen() 079 retval = listen(listen_sock, SOMAXCONN); 080 if(retval == SOCKET_ERROR) err_quit("listen()"); // 083 SOCKET client_sock; 084 SOCKADDR_IN clientaddr; 085 int addrlen; 086 char buf[bufsize]; while(1){ 089 // accept() 090 addrlen = sizeof(clientaddr); 091 client_sock = accept(listen_sock, (SOCKADDR *)&clientaddr, &addrlen); 092 if(client_sock == INVALID_SOCKET){ 093 err_display("accept()"); 094 continue; 095 } 096 printf("\nfilesender : IP =%s, =%d\n", 097 inet_ntoa(clientaddr.sin_addr), ntohs(clientaddr.sin_port)); // 100 char filename[256]; 101 ZeroMemory(filename, 256); 102 retval = recvn(client_sock, filename, 256, 0); 103 if(retval == SOCKET_ERROR){ 104 err_display("recv()"); 105 closesocket(client_sock); 106 continue; 107 } 108 printf("-> : %s\n", filename); // 111 int totalbytes; 112 retval = recvn(client_sock, (char *)&totalbytes, sizeof(totalbytes), 0); 113 if(retval == SOCKET_ERROR){ 114 err_display("recv()");

26 115 closesocket(client_sock); 116 continue; 117 } 118 printf("-> : %d\n", totalbytes); // 121 FILE *fp = fopen(filename, "wb"); 122 if(fp == NULL){ 123 perror(" "); 124 closesocket(client_sock); 125 continue; 126 } // 129 int numtotal = 0; 130 while(1){ 131 retval = recvn(client_sock, buf, BUFSIZE, 0); 132 if(retval == SOCKET_ERROR){ 133 err_display("recv()"); 134 break; 135 } 136 else if(retval == 0) 137 break; 138 else{ 139 fwrite(buf, 1, retval, fp); 140 if(ferror(fp)){ 141 perror(" "); 142 break; 143 } 144 numtotal += retval; 145 } 146 } 147 fclose(fp); // 150 if(numtotal == totalbytes) 151 printf("->!\n"); 152 else 153 printf("->!\n"); // closesocket() 156 closesocket(client_sock); 157 printf("filesender : IP =%s, =%d\n", 158 inet_ntoa(clientaddr.sin_addr), ntohs(clientaddr.sin_port)); 159 } // closesocket() 162 closesocket(listen_sock); // 165 WSACleanup(); 166 return 0; 167 }

27

28

Microsoft PowerPoint - 09-CE-23-윈도우 소켓

Microsoft PowerPoint - 09-CE-23-윈도우 소켓 순천향대학교컴퓨터학부이상정 1 학습내용 인터넷과 TCP/IP 프로토콜 소켓의생성과해제 소켓주소표현 연결지향소켓프로그래밍 순천향대학교컴퓨터학부이상정 2 인터넷과 TCP/IP 프로토콜 순천향대학교컴퓨터학부이상정 3 인터넷구조의프로토콜계층 인터넷구조의프로토콜계층 응용계층 (application layer) 응용서비스제공 http, ftp, smtp, telnet,

More information

chap7.key

chap7.key 1 7 C 2 7.1 C (System Calls) Unix UNIX man Section 2 C. C (Library Functions) C 1975 Dennis Ritchie ANSI C Standard Library 3 (system call). 4 C?... 5 C (text file), C. (binary file). 6 C 1. : fopen( )

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 소켓프로그래밍활용 IT CookBook, 유닉스시스템프로그래밍 학습목표 소켓인터페이스를활용한다양한프로그램을작성할수있다. 2/23 목차 TCP 기반프로그래밍 반복서버 동시동작서버 동시동작서버-exec함수사용하기 동시동작서버-명령행인자로소켓기술자전달하기 UDP 프로그래밍 3/23 TCP 기반프로그래밍 반복서버 데몬프로세스가직접모든클라이언트의요청을차례로처리 동시동작서버

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 1 목포해양대해양컴퓨터공학과 UDP 소켓 네트워크프로그램설계 4 장 2 목포해양대해양컴퓨터공학과 목차 제 4장 UDP 소켓 4.1 UDP 클라이언트 4.2 UDP 서버 4.3 UDP 소켓을이용한데이터송신및수신 4.4 UDP 소켓의연결 3 목포해양대해양컴퓨터공학과 UDP 소켓의특징 UDP 소켓의특성 신뢰할수없는데이터전송방식 목적지에정확하게전송된다는보장이없음.

More information

hd132x_k_v1r3_Final_.PDF

hd132x_k_v1r3_Final_.PDF HelloDevice ( HD1320E/1320/1321) Version 11 1 2 1 2 3 31 HD1320/1320E 311 312 313 RS232 32 HD1321 321 322 33 4 41 42 421 HD1320/1320E 422 HD1321 43 431 IP 432 IP 44 441 442 443 RS232 5 51 52 521 TCP 522

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 얇지만얇지않은 TCP/IP 소켓프로그래밍 C 2 판 4 장 UDP 소켓 제 4 장 UDP 소켓 4.1 UDP 클라이언트 4.2 UDP 서버 4.3 UDP 소켓을이용한데이터송싞및수싞 4.4 UDP 소켓의연결 UDP 소켓의특징 UDP 소켓의특성 싞뢰할수없는데이터젂송방식 목적지에정확하게젂송된다는보장이없음. 별도의처리필요 비연결지향적, 순서바뀌는것이가능 흐름제어 (flow

More information

Microsoft PowerPoint - 09-CE-24-채팅 프로그램

Microsoft PowerPoint - 09-CE-24-채팅 프로그램 순천향대학교컴퓨터학부이상정 1 학습내용 사용자인터페이스 프로그램구성 TCP 연결설정프로그램 서버연결설정 클라이언트연결설정 TCP 데이터송수신 순천향대학교컴퓨터학부이상정 2 사용자인터페이스 순천향대학교컴퓨터학부이상정 3 1:1 채팅프로그램 한프로그램이동시에서버와클라이언트로동작 프로그램시작시서버로동작 서버소켓생성하고상대방접속요청대기 채팅을위한연결요청시클라이언트로동작

More information

歯9장.PDF

歯9장.PDF 9 Hello!! C printf() scanf() getchar() putchar() gets() puts() fopen() fclose() fprintf() fscant() fgetc() fputs() fgets() gputs() fread() fwrite() fseek() ftell() I/O 2 (stream) C (text stream) : `/n'

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Network Programming Jo, Heeseung Network 실습 네트워크프로그래밍 멀리떨어져있는호스트들이서로데이터를주고받을수있도록프로그램을구현하는것 파일과는달리데이터를주고받을대상이멀리떨어져있기때문에소프트웨어차원에서호스트들간에연결을해주는장치가필요 이러한기능을해주는장치로소켓이라는인터페이스를많이사용 소켓프로그래밍이란용어와네트워크프로그래밍이랑용어가같은의미로사용

More information

Microsoft PowerPoint - 12 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 1.ppt

Microsoft PowerPoint - 12 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 1.ppt 12 장 소켓을이용한통신 (1) 함수 - inet_addr - inet_ntoa - socket - bind - listen - accept - connect - recv -send 1 서론 파이프를사용하여통신을하기위한시스템호출 / 표준라이브러리함수 함수 의미 inet_addr 문자열형태의인터넷주소를바이너리형태로변환한다. inet_ntoa 바이너리형태의인터넷주소를문자열형태로변환한다.

More information

Microsoft PowerPoint - 13 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 2.ppt

Microsoft PowerPoint - 13 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 2.ppt 13 장소켓을이용한통신 (2) 소켓을이용한통신 (2) 함수 - recvfrom - sendto - uname - gethostname - gethostbyname - gethostbyaddr 1 1. 서론 소켓을사용하여비연결형모델로통신을하기위한함수와그외의함수 함수 의미 recvfrom 비연결형모델에서소켓을통해메시지를수신한다. sendto 비연결형모델에서소켓을통해메시지를송신한다.

More information

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

Microsoft PowerPoint - chap13-입출력라이브러리.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 스트림의 기본 개념을 알아보고,

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 13 장소켓 2 13.1 소켓 클라이언트 - 서버모델 네트워크응용프로그램 클리이언트 - 서버모델을기반으로동작한다. 클라이언트 - 서버모델 하나의서버프로세스와여러개의클라이언트로구성된다. 서버는어떤자원을관리하고클라이언트를위해자원관련서비스를제공한다. 3 소켓의종류 소켓 네트워크에대한사용자수준의인터페이스를제공 소켓은양방향통신방법으로클라이언트 - 서버모델을기반으로프로세스사이의통신에매우적합하다.

More information

목차 목차포트스캔코드포트스캔결과포트스캔탐지코드포트스캔탐지결과 참조

목차 목차포트스캔코드포트스캔결과포트스캔탐지코드포트스캔탐지결과 참조 C++ 이용한포트스캔 Winpcap 이용기존수업시간 Client, BasicDump 코드이용 제출일 2016, 06, 01 전공사이버경찰학과 과목네트워크보안프로그래밍학번 10121702 담당교수소길자이름김주명 목차 목차포트스캔코드포트스캔결과포트스캔탐지코드포트스캔탐지결과 참조 02 03 05 06 11 12 2 포트스캔코드 #include "stdafx.h"

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

Microsoft PowerPoint - 06-CompSys-16-Socket.ppt

Microsoft PowerPoint - 06-CompSys-16-Socket.ppt 소켓시스템콜소개 TCP 클라이언트 / 서버프로그래밍 signal(), fork() 시스템콜 TCP 클라이언트 / 서버프로그래밍예 talk_client.c, talk_server.c UDP 클라이언트 / 서버프로그래밍 순천향대학교컴퓨터학부이상정 1 소켓시스템콜소개 순천향대학교컴퓨터학부이상정 2 소켓 (socket) 소켓은 TCP/IP 프로토콜을이용하기위한시스템콜인터페이스

More information

61 62 63 64 234 235 p r i n t f ( % 5 d :, i+1); g e t s ( s t u d e n t _ n a m e [ i ] ) ; if (student_name[i][0] == \ 0 ) i = MAX; p r i n t f (\ n :\ n ); 6 1 for (i = 0; student_name[i][0]!= \ 0&&

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Socket Programming 1 Jo, Heeseung 학습목표 TCP/IP 프로토콜의기본개념 IP 주소와포트번호의개념소켓관련구조체와함수소켓을이용한통신프로그램을작성 2 TCP/IP 개요 TCP/IP 인터넷의표준프로토콜 5계층 (4계층) 으로구성 TCP 와 UDP 의차이 3 IP 주소와호스트명 IP 주소와호스트명 IP 주소 : 인터넷을이용할때사용하는주소로점

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070> #include "stdafx.h" #include "Huffman.h" 1 /* 비트의부분을뽑아내는함수 */ unsigned HF::bits(unsigned x, int k, int j) return (x >> k) & ~(~0

More information

SYN flooding

SYN flooding Hacking & Security Frontier SecurityFirst SYN flooding - SYN flooding 공격의원리와코드그리고대응 by amur, myusgun, leemeca 2008. 09. myusgun Agenda 개요...3 원리...3 위협...4 잠깐! - 문서에관하여...4 이문서는...4 Code...4 대응방안...4 소스코드...5

More information

Microsoft Word - Network Programming_NewVersion_01_.docx

Microsoft Word - Network Programming_NewVersion_01_.docx 10. Unix Domain Socket 105/113 10. Unix Domain Socket 본절에서는 Unix Domain Socket(UDS) 에대한개념과이에대한실습을수행하고, 이와동시에비신뢰적인통신시스템의문제점에대해서분석하도록한다. 이번실습의목표는다음과같다. 1. Unix Domain Socket의사용법을익히고, IPC에대해서실습 2. TCP/IP의응용계층과전달계층의동작을구현및실습

More information

Microsoft PowerPoint - 15-EmbedSW-10-Socket

Microsoft PowerPoint - 15-EmbedSW-10-Socket 10. 소켓개요 TCP 클라이언트 / 서버프로그래밍절차 오드로이드 I/O 소켓프로그램예 순천향대학교컴퓨터공학과이상정 1 소켓 (Socket) 운영체제복습 소켓 (socket) 은통신의극점 (endpoint) 을정의 소켓은 IP 주소와포트번호두가지를접합 (concatenate) 해서구별 두프로세스의네트워크통신에각각하나씩두개의소켓이필요 순천향대학교컴퓨터공학과 2

More information

목 차 1. 포트스캐닝 (Port Scanning) 이란? 2. 포트 (Port) 란? 3. 스캔 (Scan) 의종류 4. 포트스캐너 (Port Scanner) 구현 5. 포트스캔 (Port Scan) 구현 6. 참조

목 차 1. 포트스캐닝 (Port Scanning) 이란? 2. 포트 (Port) 란? 3. 스캔 (Scan) 의종류 4. 포트스캐너 (Port Scanner) 구현 5. 포트스캔 (Port Scan) 구현 6. 참조 R E P O R T 제목 : 포트스캐닝 (Port Scanning) 과목명 : 네트워크보안프로그래밍 학 과 : 사이버경찰학과 학 번 : 10100245 이 름 : 김민관 제출일 : 2016년 6월 10일 ( 금 ) 담당교수 : 소길자교수님 목 차 1. 포트스캐닝 (Port Scanning) 이란? 2. 포트 (Port) 란? 3. 스캔 (Scan) 의종류

More information

Microsoft PowerPoint - Lecture_Note_5.ppt [Compatibility Mode]

Microsoft PowerPoint - Lecture_Note_5.ppt [Compatibility Mode] TCP Server/Client Department of Computer Engineering Kyung Hee University. Choong Seon Hong 1 TCP Server Program Procedure TCP Server socket() bind() 소켓생성 소켓번호와소켓주소의결합 listen() accept() read() 서비스처리, write()

More information

슬라이드 1

슬라이드 1 Computer Networks Practice Socket 1 DK Han Junghwan Song dkhan@mmlab.snu.ac.kr jhsong@mmlab.snu.ac.kr 2012-3-26 Multimedia and Mobile communications Laboratory Introduction Client / Server model Server

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 네트워크프로그래밍 02 장 TCP 소켓 (1) 1 목차 제 2장 TCP 소켓 1. IPv4 TCP 클라이언트 2. IPv4 TCP 서버 3. 소켓의생성과해지 4. 주소지정 5. 소켓에연결 6. 소켓을주소에바인딩하기 7. 클라이언트의연결요청처리 8. 데이터주고받기 9. IPv6의사용 2 소켓통신과정 간략화한소켓통신과정 소켓생성 TCP or UDP 소켓에주소정보할당

More information

<4D F736F F D2034C0E52D554E495820BCD2C4CF20C0C0BFEB20C7C1B7CEB1D7B7A1B9D6>

<4D F736F F D2034C0E52D554E495820BCD2C4CF20C0C0BFEB20C7C1B7CEB1D7B7A1B9D6> 4. UNIX 소켓응용프로그래밍 4.1 소켓의동작모드 소켓의동작모드 blocking, non-blocking, 그리고비동기 (asynchronous) 모드 소켓을처음생성하면 blocking 모드의소켓이생성 blocking 모드소켓 어떤소켓관련시스템콜을호출하였을때네트웍시스템 ( 즉, TCP/IP) 이동작을완료할때까지응용프로세스가멈추어있게 (block) 되는소켓

More information

vi 사용법

vi 사용법 네트워크프로그래밍 6 장과제샘플코드 - 1:1 채팅 (udp 버전 ) 과제 서버에서먼저 bind 하고그포트를다른사람에게알려줄것 클라이언트에서알려준포트로접속 서로간에키보드입력을받아상대방에게메시지전송 2 Makefile 1 SRC_DIR =../../common 2 COM_OBJS = $(SRC_DIR)/addressUtility.o $(SRC_DIR)/dieWithMessage.o

More information

Microsoft PowerPoint - 09-CE-25-오목게임

Microsoft PowerPoint - 09-CE-25-오목게임 순천향대학교컴퓨터학부이상정 1 학습내용 단순오목게임 인터넷오목게임 승부판정오목게임 순천향대학교컴퓨터학부이상정 2 단순오목게임 순천향대학교컴퓨터학부이상정 3 예제 49: 단순오목게임 스크린에바둑판을그리고, 스크린을터치하면해당위치에흰돌또는검은돌만표시 승부는판정하지않음 메뉴 ID_START, ID_EXIT 순천향대학교컴퓨터학부이상정 4 예제 49: 코드 (1) #define

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 소켓 2 1 소켓 클라이언트 - 서버모델 네트워크응용프로그램 클리이언트 - 서버모델을기반으로동작한다. 클라이언트 - 서버모델 하나의서버프로세스와여러개의클라이언트로구성된다. 서버는어떤자원을관리하고클라이언트를위해자원관련서비스를제공한다. 3 소켓의종류 소켓 네트워크에대한사용자수준의인터페이스를제공 소켓은양방향통신방법으로클라이언트 - 서버모델을기반으로프로세스사이의통신에매우적합하다.

More information

9장 윈도우 소켓 프로그래밍

9장   윈도우 소켓 프로그래밍 윈도우소켓프로그래밍 _A_2015 버전 IT CookBook, 윈도우 API 프로그래밍 한빛미디어의윈도우 API 프로그래밍, 윈도우네트워크프로그래밍, 혜지원 API programming 을참조함! Updated 2015.11.22 1 학습목표 TCP/IP 프로토콜의개념을이해하고, 윈도우프로그래밍을이용한간단한채팅프로그램을작성하여이해도를높인다. 내용 소켓연결 메시지교환

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Socket Programming 1 Jo, Heeseung 학습목표 TCP/IP 프로토콜의기본개념 IP 주소와포트번호의개념소켓관련구조체와함수소켓을이용한통신프로그램을작성 2 TCP/IP 개요 TCP/IP 인터넷의표준프로토콜 5 계층 (4 계층 ) 으로구성 TCP 와 UDP 의차이 3 IP 주소와호스트명 IP 주소와호스트명 IP 주소 : 인터넷을이용할때사용하는주소로점

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 1 목포해양대해양컴퓨터공학과 2 장. TCP 소켓 네트워크프로그램설계 2 목포해양대해양컴퓨터공학과 목차 제 2장 TCP 소켓 1. IPv4 TCP 클라이언트 2. IPv4 TCP 서버 3. 소켓의생성과해지 4. 주소지정 5. 소켓에연결 6. 소켓을주소에바인딩하기 7. 클라이언트의연결요청처리 8. 데이터주고받기 9. IPv6의사용 3 목포해양대해양컴퓨터공학과

More information

슬라이드 1

슬라이드 1 1 Computer Networks Practice #1-1 - Socket Programming 이지민 (jmlee@mmlab.snu.ac.kr) 장동현 (dhjang@mmlab.snu.ac.kr) 2011. 9. 14 2 Transport layer 가하는일 Reliability 패킷젂송에오류가생기면잧젂송함으로써마치 오류가나지않는것처럼 싞뢰된젂송을 Application

More information

6주차.key

6주차.key 6, Process concept A program in execution Program code PCB (process control block) Program counter, registers, etc. Stack Heap Data section => global variable Process in memory Process state New Running

More information

C++-¿Ïº®Çؼ³10Àå

C++-¿Ïº®Çؼ³10Àå C C++. (preprocessor directives), C C++ C/C++... C++, C. C++ C. C C++. C,, C++, C++., C++.,.. #define #elif #else #error #if #itdef #ifndef #include #line #pragma #undef #.,.,. #include #include

More information

1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 #define _CRT_SECURE_NO_WARNINGS #include #include main() { char ch; printf(" 문자 1개를입력하시오 : "); scanf("%c", &ch); if (isalpha(ch))

More information

금오공대 컴퓨터공학전공 강의자료

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 24. 파일입출력 2013.11.27. 오병우 컴퓨터공학과 파일 (File) 입출력 표준입출력 vs. 파일입출력 HDD 프로그래머입장에서는동일한방법으로입출력 다만 file 을읽고쓰기전에 Open 해서스트림에대한파일포인터 (file pointer) 를얻어야한다. OS 가실제작업을대행하며, 프로그래머는적절한함수를적절한방법으로호출 Department

More information

<43B7CE20BECBBEC6BAB8B4C220BCD2C4CFC7C1B7CEB1D7B7A1B9D62E687770>

<43B7CE20BECBBEC6BAB8B4C220BCD2C4CFC7C1B7CEB1D7B7A1B9D62E687770> C 로알아보는 소켓프로그래밍 이현환 (NOON) haonun@gmail.com http://noon.tistory.com Hacking Study Grup E.Y.E -------------------------------------------------------------------- 목차 --------------------------------------------------------------------

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 인터넷프로토콜 02 장 TCP 소켓 목차 제 2 장 TCP 소켓 2.1 IPv4 TCP 클라이언트 2.2 IPv4 TCP 서버 2.3 소켓의생성과해지 2.4 주소지정 2.5 소켓에연결 2.6 소켓을주소에바인딩하기 2.7 클라이언트의연결요청처리 2.8 데이터주고받기 2.9 IPv6 의사용 소켓통신과정 간략화한소켓통신과정 소켓생성 TCP or UDP 소켓에주소정보할당

More information

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D313939392D382E687770>

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D313939392D382E687770> i ii iii iv v vi 1 2 3 4 가상대학 시스템의 국내외 현황 조사 가상대학 플랫폼 개발 이상적인 가상대학시스템의 미래상 제안 5 웹-기반 가상대학 시스템 전통적인 교수 방법 시간/공간 제약을 극복한 학습동기 부여 교수의 일방적인 내용전달 교수와 학생간의 상호작용 동료 학생들 간의 상호작용 가상대학 운영 공지사항,강의록 자료실, 메모 질의응답,

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 C 기초특강 종합과제 과제내용 구조체를이용하여교과목이름과코드를파일로부터입력받아관리 구조체를이용하여학생들의이름, 학번과이수한교과목의코드와점수를파일로부터입력 학생개인별총점, 평균계산 교과목별이수학생수, 총점및평균을계산 결과를파일에저장하는프로그램을작성 2 Makefile OBJS = score_main.o score_input.o score_calc.o score_print.o

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 얇지만얇지않은 TCP/IP 소켓프로그래밍 C 2 판 Chap 2. Basic TCP Sockets Chap. 2 Basic TCP Sockets 2.1 IPv4 TCP 클라이언트 2.2 IPv4 TCP 서버 2.3 소켓의생성과해지 2.4 주소지정 2.5 소켓에연결 2.6 소켓을주소와바인딩하기 2.7 클라이언트의연결요청처리 2.8 데이터주고받기 2.9 IPv6의사용

More information

Microsoft PowerPoint - Supplement-02-Socket Overview.ppt [호환 모드]

Microsoft PowerPoint - Supplement-02-Socket Overview.ppt [호환 모드] 소켓개요 참고문헌 : 컴퓨터네트워크프로그래밍, 김화종, 홍릉과학출판사 Socket 정의 Socket 은 Transport 계층 (TCP 나 UDP) 을이용하는 API 1982 년 BSD 유닉스 41 에서처음소개 윈도우즈의경우 Winsock 제공 JAVA 또한 Socket 프로그래밍을위한클래스제공 Socket Interface 의위치 5-7 (Ses, Pre,

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 인터넷프로토콜 5 장 데이터송수신 (3) 1 파일전송메시지구성예제 ( 고정크기메시지 ) 전송방식 : 고정크기 ( 바이너리전송 ) 필요한전송정보 파일이름 ( 최대 255 자 => 255byte 의메모리공간필요 ) 파일크기 (4byte 의경우최대 4GB 크기의파일처리가능 ) 파일내용 ( 가변길이, 0~4GB 크기 ) 메시지구성 FileName (255bytes)

More information

untitled

untitled if( ) ; if( sales > 2000 ) bonus = 200; if( score >= 60 ) printf(".\n"); if( height >= 130 && age >= 10 ) printf(".\n"); if ( temperature < 0 ) printf(".\n"); // printf(" %.\n \n", temperature); // if(

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 12 장파이프 2 12.1 파이프 파이프원리 $ who sort 파이프 3 물을보내는수도파이프와비슷 한프로세스는쓰기용파일디스크립터를이용하여파이프에데이터를보내고 ( 쓰고 ) 다른프로세스는읽기용파일디스크립터를이용하여그파이프에서데이터를받는다 ( 읽는다 ). 한방향 (one way) 통신 파이프생성 파이프는두개의파일디스크립터를갖는다. 하나는쓰기용이고다른하나는읽기용이다.

More information

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 6 가지중하나. (1) 프로그램수행직후, (2) 5 초후 (3) 10 초후 (4) 15 #include <signa

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 6 가지중하나. (1) 프로그램수행직후, (2) 5 초후 (3) 10 초후 (4) 15 #include <signa 학번 : 이름 : 1. 다음가정하에서아래프로그램의출력물을예측하세요. 가정 : 부모프로세스의 process id=10100, 자식프로세스의 process id=10101. char buf[] = "a write to stdout\n"; int var; /* automatic variable on the stack */ pid_t pid; int glob = 31;

More information

Microsoft PowerPoint - chap4 [호환 모드]

Microsoft PowerPoint - chap4 [호환 모드] 제 5 장 C 표준라이브러리 숙대창병모 1 목표 C 표준라이브러리의깊이있는이해 시스템호출과 C 표준라이브러리관계 숙대창병모 2 C 입출력라이브러리함수 숙대창병모 3 시스템호출과라이브러리함수 System Calls well defined entry points directly into the kernel documented in section 2 of the

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 4 장파일 컴퓨터과학과박환수 1 2 4.1 시스템호출 컴퓨터시스템구조 유닉스커널 (kernel) 하드웨어를운영관리하여다음과같은서비스를제공 파일관리 (File management) 프로세스관리 (Process management) 메모리관리 (Memory management) 통신관리 (Communication management) 주변장치관리 (Device

More information

13주-14주proc.PDF

13주-14주proc.PDF 12 : Pro*C/C++ 1 2 Embeded SQL 3 PRO *C 31 C/C++ PRO *C NOT! NOT AND && AND OR OR EQUAL == = SQL,,, Embeded SQL SQL 32 Pro*C C SQL Pro*C C, C Pro*C, C C 321, C char : char[n] : n int, short, long : float

More information

Sena Technologies, Inc. HelloDevice Super 1.1.0

Sena Technologies, Inc. HelloDevice Super 1.1.0 HelloDevice Super 110 Copyright 1998-2005, All rights reserved HelloDevice 210 ()137-130 Tel: (02) 573-5422 Fax: (02) 573-7710 E-Mail: support@senacom Website: http://wwwsenacom Revision history Revision

More information

<4D F736F F F696E74202D E20B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D62E >

<4D F736F F F696E74202D E20B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D62E > 웹프로그래밍및실습 ( g & Practice) 문양세강원대학교 IT 대학컴퓨터과학전공 소켓 (Socket) (1/2) Socket 이란? 서버와클라이언트가서로특정한규약을사용하여데이터를전송하기위한방식 서버와클라이언트는소켓연결을기다렸다가소켓이연결되면서로데이터를전송 현재네트워크상에서의모든통신의근간은 Socket 이라할수있음 Page 2 1 소켓 (Socket) (2/2)

More information

문서개정이력 개정번호개정사유및내용개정일자 1.0 최초작성 본문서는원문작성자 (Peter Van Eeckhoutte) 의허가하에번역및배포하는문서로, 원문과관련된모든내용의저작권은 Corelan에있으며, 추가된내용에대해서는 ( 주 ) 한국정보보호교육센터에

문서개정이력 개정번호개정사유및내용개정일자 1.0 최초작성 본문서는원문작성자 (Peter Van Eeckhoutte) 의허가하에번역및배포하는문서로, 원문과관련된모든내용의저작권은 Corelan에있으며, 추가된내용에대해서는 ( 주 ) 한국정보보호교육센터에 문서번호 13-VN-06 공격코드작성따라하기 ( 원문 : 공격코드 Writing Tutorial 4) 2013.1 작성자 : ( 주 ) 한국정보보호교육센터서준석주임연구원 오류신고및관련문의 : nababora@naver.com 문서개정이력 개정번호개정사유및내용개정일자 1.0 최초작성 2013.01.31 본문서는원문작성자 (Peter Van Eeckhoutte)

More information

학번 : 이름 1. 다음프로그램실행결과를예측하시오. $./a.out & [1] 7216 $ kill -USR $ kill -USR 아래학생이작성한쓰레드코드의문제점을설명하시오. void* thread_main() { pthread_mutex_t

학번 : 이름 1. 다음프로그램실행결과를예측하시오. $./a.out & [1] 7216 $ kill -USR $ kill -USR 아래학생이작성한쓰레드코드의문제점을설명하시오. void* thread_main() { pthread_mutex_t 학번 : 이름 1. 다음프로그램실행결과를예측하시오. $./a.out & [1] 7216 $ kill -USR1 7216 $ kill -USR2 7216 2. 아래학생이작성한쓰레드코드의문제점을설명하시오. void* thread_main() pthread_mutex_t lock=pthread_mutex_initializer; pthread_mutex_lock(&lock);

More information

untitled

untitled 1 hamks@dongguk.ac.kr (goal) (abstraction), (modularity), (interface) (efficient) (robust) C Unix C Unix (operating system) (network) (compiler) (machine architecture) 1 2 3 4 5 6 7 8 9 10 ANSI C Systems

More information

제12장 파일 입출력

제12장 파일 입출력 제 4 장파일입출력 리눅스시스템프로그래밍 청주대학교전자공학과 한철수 1 시스템호출 (system call) 파일 (file) 임의접근 (random access) 주요학습내용 2 4.1 절 커널의역할 (kernel) 커널 (kernel) 은운영체제의핵심부분으로서, 하드웨어를운영관리하는여러가지서비스를제공함 파일관리 (File management) 디스크 프로세스관리

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C4C656D70656C2D5A69762E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C4C656D70656C2D5A69762E637070> /* */ /* LZWIN.C : Lempel-Ziv compression using Sliding Window */ /* */ #include "stdafx.h" #include "Lempel-Ziv.h" 1 /* 큐를초기화 */ void LZ::init_queue(void) front = rear = 0; /* 큐가꽉찼으면 1 을되돌림 */ int LZ::queue_full(void)

More information

Microsoft PowerPoint - 제11강 파일 처리

Microsoft PowerPoint - 제11강 파일 처리 제13장 파일 처리 파일열기 : File Open FILE *fp; fp=fopen( filename, r ); File handling mode: r, w, a, rb, wb, ab, r+, w+, a+ fclose(fp) 파일의종류 : Text File, Binary File Text file:.txt,.doc,.hwp Binary file:.exe,.jpg,.gif,.mov,.mpeg,.tif,.pgm,.ppm.

More information

fprintf(fp, "clf; clear; clc; \n"); fprintf(fp, "x = linspace(0, %d, %d)\n ", L, N); fprintf(fp, "U = [ "); for (i = 0; i <= (N - 1) ; i++) for (j = 0

fprintf(fp, clf; clear; clc; \n); fprintf(fp, x = linspace(0, %d, %d)\n , L, N); fprintf(fp, U = [ ); for (i = 0; i <= (N - 1) ; i++) for (j = 0 병렬계산을이용한열방정식풀기. 1. 처음 병렬계산을하기전에 C 언어를이용하여명시적유한차분법으로하나의열방정식을풀어본 다. 먼저 C 로열방정식을이해한다음초기조건만다르게하여클러스터로여러개의열방 정식을풀어보자. 2. C 를이용한명시적유한차분법으로열방적식풀기 열방정식을풀기위한자세한이론은앞서다룬 Finite-Difference method 을보기로하고 바로식 (1.10)

More information

03장.스택.key

03장.스택.key ---------------- DATA STRUCTURES USING C ---------------- 03CHAPTER 1 ? (stack): (LIFO:Last-In First-Out) 2 : top : ( index -1 ),,, 3 : ( ) ( ) -> ->. ->.... 4 Stack ADT : (LIFO) : init():. is_empty():

More information

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 4 가지중하나. (1) 프로그램수행직후, (2) kill 명령실행직후, (3) 15 #include <signal.

3. 다음장에나오는 sigprocmask 함수의설명을참고하여다음프로그램의출력물과그출력물이화면이표시되는시점을예측하세요. ( 힌트 : 각줄이표시되는시점은다음 4 가지중하나. (1) 프로그램수행직후, (2) kill 명령실행직후, (3) 15 #include <signal. 학번 : 이름 : 1. 다음가정하에서아래프로그램의출력물을예측하세요. 가정 : 부모프로세스의 process id=20100, 자식프로세스의 process id=20101. int glob = 31; /* external variable in initialized data */ char buf[] = "a write to stdout\n"; int main(void)

More information

BMP 파일 처리

BMP 파일 처리 BMP 파일처리 김성영교수 금오공과대학교 컴퓨터공학과 학습내용 영상반전프로그램제작 2 Inverting images out = 255 - in 3 /* 이프로그램은 8bit gray-scale 영상을입력으로사용하여반전한후동일포맷의영상으로저장한다. */ #include #include #define WIDTHBYTES(bytes)

More information

슬라이드 1

슬라이드 1 Task 통신및동기화 : Socket Chapter #13 강의목차 소켓개요 소켓관련시스템콜 네트워크라이브러리 스트림소켓을이용한프로세스통신 데이터그램소켓을이용한프로세스통신 Unix System Programming 2 소켓 (Socket) 소켓 (Socket) 개요 (1) 프로세스간의통신을위한데이터출입구 파이프도구를일반화 양방향데이터통신을지원 상호연관성이없는프로세스간에통신이가능

More information

Computer Programming (2008 Fall)

Computer Programming  (2008 Fall) Computer Programming Practice (2011 Winter) Practice 12 Standard C Libraries The Last Practice 2012. 01. 25 2/24 Contents Standard C Libraries Input & Output Functions : stdio.h String Functions : string.h

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 인터넷프로토콜 03 장 도메인네임시스템과주소 패밀리 (IPv4-IPv6 서비스 ) 1 목차 제 3 장도메인네임시스템과주소패밀리 3.1 도메인네임주소를숫자주소로매핑하기 3.2 IP 버전에무관한주소-범용코드의작성 3.3 숫자주소에서도메인네임주소획득하기 2 getaddrinfo() 를활용한주소 범용 (Generic) 코드 주소범용 (Generic) 코드란? 주소버전

More information

Microsoft Word - KPMC-400,401 SW 사용 설명서

Microsoft Word - KPMC-400,401 SW 사용 설명서 LKP Ethernet Card SW 사용설명서 Version Information Tornado 2.0, 2.2 알 림 여기에실린내용은제품의성능향상과신뢰도의증대를위하여예고없이변경될수도있습니다. 여기에실린내용의일부라도엘케이일레븐의사전허락없이어떠한유형의매체에복사되거나저장될수없으며전기적, 기계적, 광학적, 화학적인어떤방법으로도전송될수없습니다. 엘케이일레븐경기도성남시중원구상대원동

More information

0x00 Contents 0x About Nickster 0x Analaysis 0x Exploit

0x00 Contents 0x About Nickster 0x Analaysis 0x Exploit Defcon CTF 17 th Nickster Report StolenByte(Son Choong-Ho) http://stolenbyte.egloos.com thscndgh_4@hotmail.com WOWHACKER 2009. 08. 09 0x00 Contents 0x01 ------------- About Nickster 0x02 -------------

More information

untitled

untitled while do-while for break continue while( ) ; #include 0 i int main(void) int meter; int i = 0; while(i < 3) meter = i * 1609; printf("%d %d \n", i, meter); i++; return 0; i i< 3 () 0 (1)

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 얇지만얇지않은 TCP/IP 소켓프로그래밍 C 2 판 Chap 3. Of Names and Address Families Chap. 3 Of Names and Address Families 3.1 도메인네임주소를숫자주소로매핑하기 3.2 IP 버전에무관한주소 - 범용코드의작성 3.3 숫자주소에서도메인네임주소획득하기 기존 IPv4 전용, IPv6 전용코드의취약성

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 메모리매핑 IT CookBook, 유닉스시스템프로그래밍 학습목표 통신프로그램이무엇인지이해한다. 메모리매핑을이용한 IPC 기법을이해한다. 메모리매핑함수를사용해프로그램을작성할수있다. 2/20 목차 메모리매핑의개념 메모리매핑함수 메모리매핑해제함수 메모리매핑의보호모드변경 파일의크기확장 매핑된메모리동기화 데이터교환하기 3/20 메모리매핑의개념 메모리매핑 파일을프로세스의메모리에매핑

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 인터넷프로토콜 03 장 도메인네임시스템과주소 패밀리 (IPv4-IPv6 서비스 ) 1 목포해양대해양컴퓨터공학과 목차 제 3 장도메인네임시스템과주소패밀리 3.1 도메인네임주소를숫자주소로매핑하기 3.2 IP 버전에무관한주소-범용코드의작성 3.3 숫자주소에서도메인네임주소획득하기 2 목포해양대해양컴퓨터공학과 기존 IPv4 전용, IPv6 전용코드의 취약성 전용주소코드

More information

자바-11장N'1-502

자바-11장N'1-502 C h a p t e r 11 java.net.,,., (TCP/IP) (UDP/IP).,. 1 ISO OSI 7 1977 (ISO, International Standards Organization) (OSI, Open Systems Interconnection). 6 1983 X.200. OSI 7 [ 11-1] 7. 1 (Physical Layer),

More information

<4D F736F F F696E74202D FB8DEB8F0B8AE20B8C5C7CE205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FB8DEB8F0B8AE20B8C5C7CE205BC8A3C8AF20B8F0B5E55D> 학습목표 통신프로그램이무엇인지이해한다. 을이용한 IPC 기법을이해한다. 함수를사용해프로그램을작성할수있다. IT CookBook, 유닉스시스템프로그래밍 2/20 목차 의개념 함수 해제함수 의보호모드변경 파일의크기확장 매핑된메모리동기화 데이터교환하기 의개념 파일을프로세스의메모리에매핑 프로세스에전달할데이터를저장한파일을직접프로세스의가상주소공간으로매핑 read, write

More information

10.

10. 10. 10.1 10.2 Library Routine: void perror (char* str) perror( ) str Error 0 10.3 10.3 int fd; /* */ fd = open (filename, ) /*, */ if (fd = = -1) { /* */ } fcnt1 (fd, ); /* */ read (fd, ); /* */ write

More information

Microsoft PowerPoint - 04-UDP Programming.ppt

Microsoft PowerPoint - 04-UDP Programming.ppt Chapter 4. UDP Dongwon Jeong djeong@kunsan.ac.kr http://ist.kunsan.ac.kr/ Dept. of Informatics & Statistics 목차 UDP 1 1 UDP 개념 자바 UDP 프로그램작성 클라이언트와서버모두 DatagramSocket 클래스로생성 상호간통신은 DatagramPacket 클래스를이용하여

More information

http://cafedaumnet/pway Chapter 1 Chapter 2 21 printf("this is my first program\n"); printf("\n"); printf("-------------------------\n"); printf("this is my second program\n"); printf("-------------------------\n");

More information

슬라이드 1

슬라이드 1 23. Sockets Input/Output Operations 일반대학원컴퓨터과학과 최윤기 (filterk7@gmail.com) Connection-oriented Model Client-Server 간통싞전에, 미리핚쌍의소켓을연결해두는개념. socket() 의 type argument 에 SOCK_STREAM 으로지정. TCP(Transmission Control

More information

Microsoft PowerPoint C-구조체

Microsoft PowerPoint C-구조체 순천향대학교컴퓨터공학과이상정 1 학습내용 구조체 (structure) 구조체선언, 멤버참조 구조체초기화, 인수전달 자기참조구조체, 연결리스트 공용체 (union) 비트필드 (bit field) 순천향대학교컴퓨터공학과 2 구조체란? 구조체는하나의변수명으로여러개의상이한자료를한꺼번에다루려고할때사용 구조체선언 struct 태그명 ; 멤버리스트 순천향대학교컴퓨터공학과

More information

[ 목차 ] 1. 취약점개요 2. 배경지식 3. 취약점발생결과 (exploit 테스트 ) 4. 취약점발생원인분석 4.1 취약점 Q&A 5. exploit 분석 6. 보안대책 7. 결론 8. 레퍼런스 2

[ 목차 ] 1. 취약점개요 2. 배경지식 3. 취약점발생결과 (exploit 테스트 ) 4. 취약점발생원인분석 4.1 취약점 Q&A 5. exploit 분석 6. 보안대책 7. 결론 8. 레퍼런스 2 CVE-2016-3857 취약점분석보고서 ( 안드로이드커널임의쓰기취약점 ) ㅁ작성자 : x90c (x90chacker@gmail.com) ㅁ작성일 : 2018 년 7 월 18 일 ( 수 ) ㅁ대외비등급 : A (Top Secret) 1 [ 목차 ] 1. 취약점개요 2. 배경지식 3. 취약점발생결과 (exploit 테스트 ) 4. 취약점발생원인분석 4.1 취약점

More information

1장. 유닉스 시스템 프로그래밍 개요

1장.  유닉스 시스템 프로그래밍 개요 Unix 프로그래밍및실습 7 장. 시그널 - 과제보충 응용과제 1 부모프로세스는반복해서메뉴를출력하고사용자로부터주문을받아자식프로세스에게주문내용을알린다. (SIGUSR1) ( 일단주문을받으면음식이완료되기전까지 SIGUSR1 을제외한다른시그널은모두무시 ) timer 자식프로세스는주문을받으면조리를시작한다. ( 일단조리를시작하면음식이완성되기전까지 SIGALARM 을제외한다른시그널은모두무시

More information

제 14 장포인터활용 유준범 (JUNBEOM YOO) Ver 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다.

제 14 장포인터활용 유준범 (JUNBEOM YOO) Ver 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 제 14 장포인터활용 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 이중포인터란무엇인가? 포인터배열 함수포인터 다차원배열과포인터 void 포인터 포인터는다양한용도로유용하게활용될수있습니다. 2 이중포인터

More information

Network Programming

Network Programming Part 3 Socket Programming for Content Delivery in Multimedia Networks (Unix 기반 ) 유닉스소켓시스템콜 BSD 소켓 API의소개 IP 주소변환설명 소켓을이용한클라이언트및서버프로그램작성방법소개 유닉스시스템콜 signal()

More information

Unix Network Programming Chapter 4. Elementary TCP Sockets

Unix Network Programming Chapter 4. Elementary TCP Sockets Unix Network Programming Chapter 14. Advanced I/O Functions 광운대학교컴퓨터과학과 정보통신연구실 석사과정안중현 14.1 Introduction 이장에서소개되고있는내용 I/O operation 에서 timeout 을설정하는세가지방법 세가지 Read/Write 관련함수 recv/send readv/writev recvmsg/sendmsg

More information

Network Programming

Network Programming Part 3 Socket Programming (Unix 기반 ) 목차 Socket 의개념 BSD 소켓 API 의소개 Socket 생성및 ID IP 주소변환설명 Socket 사용형태 소켓을이용한클라이언트및서버프로그램작성방법소개 채칭프로그램작성

More information

11장 포인터

11장 포인터 Dynamic Memory and Linked List 1 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것 메모리의크기는프로그램이시작하기전에결정 int i, j; int buffer[80]; char name[] = data structure"; 처음에결정된크기보다더큰입력이들어온다면처리하지못함

More information

Microsoft PowerPoint - Lesson13.pptx

Microsoft PowerPoint - Lesson13.pptx 2008 Spring Computer Engineering g Programming g 1 Lesson 13 - 제 16 장파일입출력 Lecturer: JUNBEOM YOO jbyoo@konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 파일의기초 텍스트파일읽기와쓰기 이진파일읽기와쓰기 임의접근파일 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다.

More information

chap8.PDF

chap8.PDF 8 Hello!! C 2 3 4 struct - {...... }; struct jum{ int x_axis; int y_axis; }; struct - {...... } - ; struct jum{ int x_axis; int y_axis; }point1, *point2; 5 struct {....... } - ; struct{ int x_axis; int

More information

Microsoft Word - MSOffice_WPS_analysis.doc

Microsoft Word - MSOffice_WPS_analysis.doc MS Office.WPS File Stack Overflow Exploit 분석 (http://milw0rm.com/ 에공개된 exploit 분석 ) 2008.03.03 v0.5 By Kancho ( kancholove@gmail.com, www.securityproof.net ) milw0rm.com에 2008년 2월 13일에공개된 Microsoft Office.WPS

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 소켓프로그래밍기초 IT CookBook, 유닉스시스템프로그래밍 학습목표 TCP/IP 프로토콜의기본개념을이해한다. IP 주소와포트번호의개념을이해한다. 소켓관련구조체와함수를이해한다. 소켓을이용한통신프로그램을작성할수있다. 2/42 목차 TCP/IP 개요 IP 주소와호스트명 포트번호 소켓프로그래밍기초 소켓인터페이스함수 유닉스도메인소켓예제 인터넷소켓예제 3/42 TCP/IP

More information

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어 개나리 연구소 C 언어 노트 (tyback.egloos.com) 프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어먹고 하더라구요. 그래서,

More information

hd1300_k_v1r2_Final_.PDF

hd1300_k_v1r2_Final_.PDF Starter's Kit for HelloDevice 1300 Version 11 1 2 1 2 3 31 32 33 34 35 36 4 41 42 43 5 51 52 6 61 62 Appendix A (cross-over) IP 3 Starter's Kit for HelloDevice 1300 1 HelloDevice 1300 Starter's Kit HelloDevice

More information

C Programming

C Programming C Programming 파일입출력 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 파일입출력 파일입출력함수 파일처리함수 2 파일입출력 파일입출력 파일의이해 파일입출력의이해 파일입출력함수 파일처리함수 3 파일의이해 파일 (File) 하나의단위로취급해야하는데이터들의외부적컬렉션 파일의종류 텍스트파일 :

More information

106 107, ( ),, ( ), 3, int kor[5]; int eng[5]; int Microsoft Windows 4 (ANSI C2 ) int kor[5] 20 # define #define SIZE 20 int a[10]; char c[10]; float

106 107, ( ),, ( ), 3, int kor[5]; int eng[5]; int Microsoft Windows 4 (ANSI C2 ) int kor[5] 20 # define #define SIZE 20 int a[10]; char c[10]; float Part 2 31 32 33 106 107, ( ),, ( ), 3, int kor[5]; int eng[5]; int Microsoft Windows 4 (ANSI C2 ) int kor[5] 20 # define #define SIZE 20 int a[10]; char c[10]; float f[size]; /* 10 /* c 10 /* f 20 3 1

More information

5.스택(강의자료).key

5.스택(강의자료).key CHP 5: https://www.youtube.com/watch?v=ns-r91557ds ? (stack): (LIFO:Last-In First-Out):. D C B C B C B C B (element) C (top) B (bottom) (DT) : n element : create() ::=. is_empty(s) ::=. is_full(s) ::=.

More information

untitled

untitled 자료형 기본자료형 : char, int, float, double 등 파생자료형 : 배열, 열거형, 구조체, 공용체 vs struct 구조체 _ 태그 _ 이름 자료형멤버 _ 이름 ; 자료형멤버 _ 이름 ;... ; struct student int number; // char name[10]; // double height; // ; // x값과 y값으로이루어지는화면의좌표

More information

untitled

untitled Step Motor Device Driver Embedded System Lab. II Step Motor Step Motor Step Motor source Embedded System Lab. II 2 open loop, : : Pulse, 1 Pulse,, -, 1 +5%, step Step Motor (2),, Embedded System Lab. II

More information

교육지원 IT시스템 선진화

교육지원 IT시스템 선진화 Module 16: ioctl 을활용한 LED 제어디바이스드라이버 ESP30076 임베디드시스템프로그래밍 (Embedded System Programming) 조윤석 전산전자공학부 주차별목표 ioctl() 을활용법배우기 커널타이머와 ioctl 을활용하여 LED 제어용디바이스드라이브작성하기 2 IOCTL 을이용한드라이버제어 ioctl() 함수활용 어떤경우에는읽는용도로만쓰고,

More information

네트워크 패턴 오버뷰 (간단한 데모 후) 대표 : 그런데, 지금 생각해보니 단일 사용자 환경은 너무 미흡하 네. 다중 사용자를 지원해야겠네. 그리고 윈도우 외 리눅 스나 유닉스 환경에서 작동했으면 좋겠네. <표 2>와 같은 스펙 문서를 다시 작성한다. 프로젝트 웹서버개

네트워크 패턴 오버뷰 (간단한 데모 후) 대표 : 그런데, 지금 생각해보니 단일 사용자 환경은 너무 미흡하 네. 다중 사용자를 지원해야겠네. 그리고 윈도우 외 리눅 스나 유닉스 환경에서 작동했으면 좋겠네. <표 2>와 같은 스펙 문서를 다시 작성한다. 프로젝트 웹서버개 PENreport 네트워크 패턴을 이용한 채팅 서버 구현 1 네트워크 패턴 오버뷰 OPENreport 디자인 패턴이란 이미 많은 이들이 고민했던 문제에 대한 해결책을 제시하고 이를 정리한 것을 말한다. 대부분의 프로그 래머들이 디자인 패턴에 관심을 가지고 이를 학습하면서 이용하고 있지만, 아주 기본적인 패턴만 알고 있을 뿐 특정 도메 인 관련 패턴은 쉽게 접하지

More information

4. What will be the output of this program? Explain results for each variable and each thread. #include "apue.h" int var=1; pthread_mutex_t lock; void

4. What will be the output of this program? Explain results for each variable and each thread. #include apue.h int var=1; pthread_mutex_t lock; void 학번 : 이름 : 1. What will be the output of this program? assumption: parent's process id=10100, child process id=10101. #include "apue.h" char buf[] = "a write to stdout\n"; int main(void) int var; /* automatic

More information