본 강의에 들어가기 전

Size: px
Start display at page:

Download "본 강의에 들어가기 전"

Transcription

1 인터넷프로토콜 02 장 TCP 소켓

2 목차 제 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 의사용

3 소켓통신과정 간략화한소켓통신과정 소켓생성 TCP or UDP 소켓에주소정보할당 IP address, Port number 소켓연결 클라이언트소켓과서버소켓연결 bind(), listen(), connect(), accept() 데이터전송 send(), recv()

4 TCP/IP 소켓의생성 소켓생성 어떠한소켓을생성할것인가를명시 ( 프로토콜종류 ) int socket(int family,int type,int proto); TCP/IP 소켓의경우 Family Type Protocol TCP PF_INET SOCK_STREAM IPPROTO_TCP UDP SOCK_DGRAM IPPROTO_UDP Socket 식별자 UNIX의파일식별자와동일 Windows의경우, WinSock에서사용하는소켓핸들 Windows의경우, 파일핸들과같지않음 반환값 : 소켓식별자인양의정수, 에러의경우 -1

5 TCP/IP 소켓식별자 유닉스 / 리눅스계열에서식별자공간 0 1 Descriptor Table Data structure for file 0 Data structure for file Family: PF_INET Service: SOCK_STREAM Local IP: Remote IP: Local Port: 2249 Remote Port: 3726

6 TCP/IP 소켓의주소지정 (1) struct sockaddr 사용 여러가지프로토콜을사용하기때문에 1) 프로토콜종류, 2) 주소를지정해야함 TCP/IP 의경우는인터넷주소임을알리는 AF_INET, IP 주소, Port 번호가필요 IP : IPv4 주소형식과 IPv6 주소형식으로나뉨 Ports : TCP/UDP 관계없이 0~65535 사이의값사용 well-known (port ) dynamic or private (port )

7 TCP/IP 소켓의주소지정 (2) 범용 (Generic) 소켓주소구조체 struct sockaddr { unsigned short sa_family; /* Address family (e.g., AF_INET) */ char sa_data[14]; /* Protocol-specific address information */ }; IPv4 에사용되는소켓주소구조체 struct sockaddr_in { unsigned short sin_family; /* Internet protocol (AF_INET) */ unsigned short sin_port; /* Port (16-bits) */ struct in_addr sin_addr; /* Internet address (32-bits) */ char sin_zero[8]; /* Not used */ }; struct in_addr { unsigned long s_addr; /* Internet address (32-bits) */ }; 교재본문과비교 sockaddr Family Blob 2 bytes 2 bytes 4 bytes 8 bytes sockaddr_in Family Port Internet address Not used

8 TCP/IP 소켓의주소지정 (3) IPv6 에사용되는소켓주소구조체 struct sockaddr_in6 { sa_family_t sin6_family; in_port_t sin6_port; uint32_t sin6_flowinfo; struct in6_addr sin6_addr; uint32_t sin6_scope_id; }; // Internet protocol(af_inet6) // Address port(16bits) // Flow information // IPv6 address(128bits) // Scope identifier struct in_addr{ uint32_t s_addr[16]; }; // Internet address(128bits) 모든종류의 sockaddr 을수용하기위한구조체 struct sockaddr_storage { sa_family_t };

9 주소정보를소켓에할당 bind() 를사용하여주소정보를생성된소켓에할당 int bind( int sockfd, struct sockaddr *localaddr, int addrlen); 성공시 0, 실패시 -1 int mysock,err; struct sockaddr_in myaddr; char* servip; /* ex) */ mysock = socket(pf_inet,sock_stream,0); myaddr.sin_family = AF_INET; myaddr.sin_port = htons( portnum ); myaddr.sin_addr.s_addr = inet_addr(servip); err=bind(mysock, (sockaddr *) &myaddr, sizeof(myaddr));

10 클라이언트 서버통신 클라이언트가먼저서버에게연결요청 서버의프로세스는미리소켓을열고대기하고있어야함 서버는특정포트를열고대기하여야하며클라이언트는이포트를알고있어야함 클라이언트는서버에연결 이때클라이언트는서버의 IP, Port 정보를응용프로그램에게명시하여접속가능

11 TCP 연결흐름도 연결요청 다음클라이언트로부터연결요청을기다림

12 서버의연결대기함수 - listen() TCP 와같은연결지향서버에사용 소켓의상태를대기상태로바꿈 int listen(int socket, int queuelimit); socket: 생성된소켓의식별자 queuelimit : 연결을수행중에다른연결이들어오면연결요청을 queue 에넣고보류, 이때사용하는 queue 의크기

13 서버의연결대기함수 - accept() int accept(int socket, struct sockaddr *clientdaddress, int addr_len); listen() 호출후, accept() 를수행하면 클라이언트의연결요청 (connect()) 에대해응답합 passive open 클라이언트와데이터송수신 (send/recv) 이가능한새로운소켓식별자를반환

14 클라이언트의연결함수 - Connect() int connect(int socket, struct sockaddr *foreignaddress, int addr_len); 클라이언트는 connect() 를호출하여연결의상태를 active open 으로만듬 foreignaddress 는서버의 IP, port 를담고있는주소구조체

15 Send(to), Recv(from) 연결이이루어진후에는 send/recv 를이용하여데이터의송수신이가능 int send(int socket, char *message, int msg_len, int flags); 주어진소켓을통하여 message 의송신이가능 int recv(int scoket, char *buffer, int buf_len, int flags) 주어진소켓을통해주어진 buffer 에데이터를수신

16 클라이언트와서버의통신 클라이언트 : 연결을초기화하는주체 Client: Bob Server: Jane Hi. I m Bob. Hi, Bob. I m Jane Nice to meet you, Jane. 서버 : 수동적으로연결을기다림

17 TCP 상의서버 / 클라이언트통신 서버는클라이언트의연결을받아들일준비를하고시작 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

18 TCP 상의서버 / 클라이언트통신 /* Create socket for incoming connections */ if ((servsock = socket(pf_inet, SOCK_STREAM, IPPROTO_TCP)) < 0) DieWithSystemMessage("socket() failed"); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

19 TCP 상의서버 / 클라이언트통신 echoservaddr.sin_family = AF_INET; /* Internet address family */ echoservaddr.sin_addr.s_addr = htonl(inaddr_any);/* Any incoming interface */ echoservaddr.sin_port = htons(echoservport); /* Local port */ if (bind(servsock,(struct sockaddr *) &echoservaddr, sizeof(echoservaddr)) < 0) DieWithSystemMessage("bind() failed"); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

20 TCP 상의서버 / 클라이언트통신 /* Mark the socket so it will listen for incoming connections */ if (listen(servsock, MAXPENDING) < 0) DieWithSystemMessage("listen() failed"); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

21 TCP 상의서버 / 클라이언트통신 for (;;) /* Run forever */ { clntlen = sizeof(echoclntaddr); if ((clntsock=accept(servsock,(struct sockaddr *)&echoclntaddr,&clntlen)) < 0) DieWithError("accept() failed"); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

22 TCP 상의서버 / 클라이언트통신 서버는이시점에서클라이언트의연결을처리하기위해서대기 클라이언트는서버에연결시도 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

23 TCP 상의서버 / 클라이언트통신 /* Create a reliable, stream socket using TCP */ if ((sock = socket(pf_inet, SOCK_STREAM, IPPROTO_TCP)) < 0) DieWithSystemMessage("socket() failed"); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

24 TCP 상의서버 / 클라이언트통신 echoservaddr.sin_family = AF_INET; /* Internet address family */ echoservaddr.sin_addr.s_addr = inet_addr(servip); /* Server IP address */ echoservaddr.sin_port = htons(echoservport); /* Server port */ if (connect(sock,(struct sockaddr *)&echoservaddr, sizeof(echoservaddr)) < 0) DieWithSystemMessage ("connect() failed"); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

25 TCP 상의서버 / 클라이언트통신 if ((clntsock=accept(servsock,(struct sockaddr *)&echoclntaddr,&clntlen)) < 0) DieWithError("accept() failed"); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

26 TCP 상의서버 / 클라이언트통신 echostringlen = strlen(echostring); /* Determine input length */ /* Send the string to the server */ if (send(sock, echostring, echostringlen, 0)!= echostringlen) DieWithUserMessage ("send() sent a different number of bytes than expected"); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

27 TCP 상의서버 / 클라이언트통신 /* Receive message from client */ if ((recvmsgsize = recv(clntsocket, echobuffer, RCVBUFSIZE, 0)) < 0) DieWithSystemMessage("recv() failed"); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

28 TCP 상의서버 / 클라이언트통신 close(sock); close(clntsocket); 서버 클라이언트 2. 연결설정 3. 데이터송수신 4. 연결종료 2. 소켓에포트할당 3. 소켓상태를대기 (listen) 로변경 4. 다음을반복적으로수행 a. 새로운연결을받아들임 b. 데이터송수신 c. 연결을종료

29 TCP 데이터교환 클라이언트는사전에서버의주소정보 (IP, port) 를알아야함 서버는클라이언트가접속할포트만정하고있음 send() 와 recv() 간에는어떠한정해진룰이없음 Client send( Hello Bob ) recv() -> Hi Jane Server recv() -> Hello recv() -> Bob send( Hi ) send( Jane )

30 연결종료 연결을종료하기위해서 close() 를사용 파일의 EOF 와유사 echo Client echo Server send(string) while (not received entire string) recv(buffer) print(buffer) recv(buffer) while(client has not closed connection) send(buffer) recv(buffer) close(socket) close(client socket)

31 Practical.h #ifndef PRACTICAL_H_ #define PRACTICAL_H_ #include <stdbool.h> #include <stdio.h> #include <sys/socket.h> // Handle error with user msg void DieWithUserMessage(const char *msg, const char *detail); // Handle error with sys msg void DieWithSystemMessage(const char *msg); // Print socket address void PrintSocketAddress(const struct sockaddr *address, FILE *stream); // Test socket address equality bool SockAddrsEqual(const struct sockaddr *addr1, const struct sockaddr *addr2); // Create, bind, and listen a new TCP server socket int SetupTCPServerSocket(const char *service); // Accept a new TCP connection on a server socket int AcceptTCPConnection(int servsock); // Handle new TCP client void HandleTCPClient(int clntsocket); // Create and connect a new TCP client socket int SetupTCPClientSocket(const char *server, const char *service); enum sizeconstants { MAXSTRINGLENGTH = 128, BUFSIZE = 512, }; #endif // PRACTICAL_H_

32 TCPEchoClient4.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <unistd.h> 5 #include <sys/types.h> 6 #include <sys/socket.h> 7 #include <netinet/in.h> 8 #include <arpa/inet.h> 9 #include "Practical.h" int main(int argc, char *argv[]) { if (argc < 3 argc > 4) // Test for correct number of arguments 14 DieWithUserMessage("Parameter(s)", 15 "<Server Address> <Echo Word> [<Server Port>]"); char *servip = argv[1]; // First arg: server IP address (dotted quad) 18 char *echostring = argv[2]; // Second arg: string to echo // Third arg (optional): server port (numeric). 7 is well-known echo port 21 in_port_t servport = (argc == 4)? atoi(argv[3]) : 7; // Create a reliable, stream socket using TCP 24 int sock = socket(af_inet, SOCK_STREAM, IPPROTO_TCP); 25 if (sock < 0) 26 DieWithSystemMessage("socket() failed");

33 TCPEchoClient4.c // Construct the server address structure 29 struct sockaddr_in servaddr; // Server address 30 memset(&servaddr, 0, sizeof(servaddr)); // Zero out structure 31 servaddr.sin_family = AF_INET; // IPv4 address family 32 // Convert address 33 int rtnval = inet_pton(af_inet, servip, &servaddr.sin_addr.s_addr); 34 if (rtnval == 0) 35 DieWithUserMessage("inet_pton() failed", "invalid address string"); 36 else if (rtnval < 0) 37 DieWithSystemMessage("inet_pton() failed"); 38 servaddr.sin_port = htons(servport); // Server port // Establish the connection to the echo server 41 if (connect(sock, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0) 42 DieWithSystemMessage("connect() failed"); size_t echostringlen = strlen(echostring); // Determine input length // Send the string to the server 47 ssize_t numbytes = send(sock, echostring, echostringlen, 0); 48 if (numbytes < 0) 49 DieWithSystemMessage("send() failed"); 50 else if (numbytes!= echostringlen) 51 DieWithUserMessage("send()", "sent unexpected number of bytes");

34 TCPEchoClient4.c // Receive the same string back from the server 54 unsigned int totalbytesrcvd = 0; // Count of total bytes received 55 fputs("received: ", stdout); // Setup to print the echoed string 56 while (totalbytesrcvd < echostringlen) { 57 char buffer[bufsize]; // I/O buffer 58 /* Receive up to the buffer size (minus 1 to leave space for 59 a null terminator) bytes from the sender */ 60 numbytes = recv(sock, buffer, BUFSIZE - 1, 0); 61 if (numbytes < 0) 62 DieWithSystemMessage("recv() failed"); 63 else if (numbytes == 0) 64 DieWithUserMessage("recv()", "connection closed prematurely"); 65 totalbytesrcvd += numbytes; // Keep tally of total bytes 66 buffer[numbytes] = '\0'; // Terminate the string! 67 fputs(buffer, stdout); // Print the echo buffer 68 } fputc('\n', stdout); // Print a final linefeed close(sock); 73 exit(0); 74 }

35 TCPEchoServer4.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <sys/types.h> 5 #include <sys/socket.h> 6 #include <netinet/in.h> 7 #include <arpa/inet.h> 8 #include "Practical.h" 9 10 static const int MAXPENDING = 5; // Maximum outstanding connection requests int main(int argc, char *argv[]) { if (argc!= 2) // Test for correct number of arguments 15 DieWithUserMessage("Parameter(s)", "<Server Port>"); in_port_t servport = atoi(argv[1]); // First arg: local port // Create socket for incoming connections 20 int servsock; // Socket descriptor for server 21 if ((servsock = socket(af_inet, SOCK_STREAM, IPPROTO_TCP)) < 0) 22 DieWithSystemMessage("socket() failed"); 23

36 TCPEchoServer4.c 24 // Construct local address structure 25 struct sockaddr_in servaddr; // Local address 26 memset(&servaddr, 0, sizeof(servaddr)); // Zero out structure 27 servaddr.sin_family = AF_INET; // IPv4 address family 28 servaddr.sin_addr.s_addr = htonl(inaddr_any); // Any incoming interface 29 servaddr.sin_port = htons(servport); // Local port // Bind to the local address 32 if (bind(servsock, (struct sockaddr*) &servaddr, sizeof(servaddr)) < 0) 33 DieWithSystemMessage("bind() failed"); // Mark the socket so it will listen for incoming connections 36 if (listen(servsock, MAXPENDING) < 0) 37 DieWithSystemMessage("listen() failed"); for (;;) { // Run forever 40 struct sockaddr_in clntaddr; // Client address 41 // Set length of client address structure (in-out parameter) 42 socklen_t clntaddrlen = sizeof(clntaddr); // Wait for a client to connect 45 int clntsock = accept(servsock, (struct sockaddr *) &clntaddr, &clntaddrlen); 46 if (clntsock < 0) 47 DieWithSystemMessage("accept() failed");

37 TCPEchoServer4.c // clntsock is connected to a client! char clntname[inet_addrstrlen]; // String to contain client address 52 if (inet_ntop(af_inet, &clntaddr.sin_addr.s_addr, clntname, 53 sizeof(clntname))!= NULL) 54 printf("handling client %s/%d\n", clntname, ntohs(clntaddr.sin_port)); 55 else 56 puts("unable to get client address"); HandleTCPClient(clntSock); 59 } 60 // NOT REACHED 61 }

38 HandleTCPClient() 1 void HandleTCPClient(int clntsocket) { 2 char buffer[bufsize]; // Buffer for echo string 3 4 // Receive message from client 5 ssize_t numbytesrcvd = recv(clntsocket, buffer, BUFSIZE, 0); 6 if (numbytesrcvd < 0) 7 DieWithSystemMessage("recv() failed"); 8 9 // Send received string and receive again until end of stream 10 while (numbytesrcvd > 0) { // 0 indicates end of stream 11 // Echo message back to client 12 ssize_t numbytessent = send(clntsocket, buffer, numbytesrcvd, 0); 13 if (numbytessent < 0) 14 DieWithSystemMessage("send() failed"); 15 else if (numbytessent!= numbytesrcvd) 16 DieWithUserMessage("send()", "sent unexpected number of bytes"); // See if there is more data to receive 19 numbytesrcvd = recv(clntsocket, buffer, BUFSIZE, 0); 20 if (numbytesrcvd < 0) 21 DieWithSystemMessage("recv() failed"); 22 } close(clntsocket); // Close client socket 25 }

39 컴파일방법 리눅스환경 Native 리눅스 /VMware 리눅스 / Cygwin 환경 유닉스기반 (iris.mmu.ac.kr) $ gcc < 컴파일옵션 > -o < 실행파일 > < 소스파일들 > -lsocket lnsl 리눅스기반 (lily.mmu.ac.kr) $ gcc < 컴파일옵션 > -o < 실행파일 > < 소스파일들 > 주의 std=c99 로컴파일할때일부헤더파일 (netdb.h) 을제대로포함시키지못하는오류가확인되었습니다. for 루프안에서변수선언하는부분만수정해서컴파일하세요.

40 과제 클라이언트 서버프로그램작성 ( 총 200점 ) 동작확인 (100점) echo_srv 6000 echo_cli Test 6000 (lily) echo_cli Test 6000 (iris) 프로그램설명 ( 발표자료또는보고서형식 100점 ) 컴파일과정 주요헤더파일설명 프로그램코드설명 제출기한 : 3월 19일자정 응용 클라이언트프로그램개선 1 (100 점 ) echo_cli 주소포트번호문장순서로변경 echo_cli This is a test 클라이언트프로그램개선 2 (200점) echo_cli 주소포트번호 키보드로부터입력을받아서버에게전달 서버로부터응답받은후다시반복 제출기한 : 3월 23일자정

본 강의에 들어가기 전

본 강의에 들어가기 전 네트워크프로그래밍 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

본 강의에 들어가기 전

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

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

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

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

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

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

PowerPoint 프레젠테이션

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

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

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 - 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 얇지만얇지않은 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

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

제1장 Unix란 무엇인가?

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

More information

2009년 상반기 사업계획

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

More information

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

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾ P a 02 r t Chapter 4 TCP Chapter 5 Chapter 6 UDP Chapter 7 Chapter 8 GUI C h a p t e r 04 TCP 1 3 1 2 3 TCP TCP TCP [ 4 2] listen connect send accept recv send recv [ 4 1] PC Internet Explorer HTTP HTTP

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

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

Chapter 4 UDP 소켓 사용법

Chapter 4 UDP 소켓 사용법 Chapter 4 UDP 소켓사용법 개요 소켓이란 (Unix 소켓 ) 소켓의구조 소켓의유형 UDP 에대한이해 교재 Chapter 4.1 UDP 클라이언트 교재 Chapter 4.2 UDP 서버 교재 Chapter 4.3 UDP 소켓을이용한 송신및수신 소켓이란? Socket 은통신을위한끝점 (endpoint) 을생성하여파일에대한 open 과유사한방식으로기술자

More information

IPv6 적용

IPv6 적용 IPv6 적용 1 IPv6 기본규격 2 IPv6 Basic header 3 IPv6 - Extension Headers (1) Hop-by-Hop Options (0) RSVP, PIM/MLD, etc. Routing (43) Source Routing, MIPv6 Fragment (44) Encapsulating Security Payload (50) IPsec

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

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

<43B7CE20BECBBEC6BAB8B4C220BCD2C4CFC7C1B7CEB1D7B7A1B9D62E687770>

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

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장 Unix란 무엇인가?

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

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

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 - 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

슬라이드 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

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

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 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

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

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

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

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드]

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드] - Socket Programming in Java - 목차 소켓소개 자바에서의 TCP 프로그램작성방법 주요클래스와메소드 HTTP 프로토콜을이용한예제 에코프로그램 Q/A 에코프로그램 - EchoServer 에코프로그램 - EchoClient TCP Programming 1 소켓소개 IP, Port, and Socket 포트 (Port): 전송계층에서통신을수행하는응용프로그램을찾기위한주소

More information

2009년 상반기 사업계획

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

More information

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D> 리눅스 오류처리하기 2007. 11. 28 안효창 라이브러리함수의오류번호얻기 errno 변수기능오류번호를저장한다. 기본형 extern int errno; 헤더파일 라이브러리함수호출에실패했을때함수예 정수값을반환하는함수 -1 반환 open 함수 포인터를반환하는함수 NULL 반환 fopen 함수 2 유닉스 / 리눅스 라이브러리함수의오류번호얻기 19-1

More information

Microsoft PowerPoint - 03-TCP Programming.ppt

Microsoft PowerPoint - 03-TCP Programming.ppt Chapter 3. - Socket in Java - 목차 소켓소개 자바에서의 프로그램작성방법 주요클래스와메소드 HTTP 프로토콜을이용한예제 에코프로그램 에코프로그램 - EchoServer 에코프로그램 - EchoClient Q/A 1 1 소켓소개 IP,, and Socket 포트 (): 전송계층에서통신을수행하는응용프로그램을찾기위한주소 소켓 (Socket):

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

[ 목차 ] 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

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

슬라이드 1

슬라이드 1 / 유닉스시스템개요 / 파일 / 프로세스 01 File Descriptor file file descriptor file type unix 에서의파일은단지바이트들의나열임 operating system 은파일에어떤포맷도부과하지않음 파일의내용은바이트단위로주소를줄수있음 file descriptor 는 0 이나양수임 file 은 open 이나 creat 로 file

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

학번 : 이름 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 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

<43B7CE20BECBBEC6BAB8B4C C5EBBDC52E687770>

<43B7CE20BECBBEC6BAB8B4C C5EBBDC52E687770> C 로알아보는 UDP 통신 이현환 (NOON) haonun@gmail.com http://noon.tistory.com Hacking Study Grup E.Y.E -------------------------------------------------------------------- 목차 --------------------------------------------------------------------

More information

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

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

More information

bn2019_2

bn2019_2 arp -a Packet Logging/Editing Decode Buffer Capture Driver Logging: permanent storage of packets for offline analysis Decode: packets must be decoded to human readable form. Buffer: packets must temporarily

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

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D313939392D382E687770>

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

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED Controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

<4D F736F F D204B FC7C1B7CEB1D7B7A55FC0AFB4D0BDBA20B1E2B9DD20BCD2C4CF20C7C1B7CEB1D7B7A1B9D65FC0CCC8A3BCBA2E646F63>

<4D F736F F D204B FC7C1B7CEB1D7B7A55FC0AFB4D0BDBA20B1E2B9DD20BCD2C4CF20C7C1B7CEB1D7B7A1B9D65FC0CCC8A3BCBA2E646F63> 유닉스기반소켓프로그래밍 exp team 이호성 (astromaker@dreamwiz.com) 1. Network 의기본 네트워크의기본적인사항에대해먼저알아보도록하겠습니다. 거의인터넷표준으로자리잡은 TCP/IP에대해서만알아보도록하겠습니다. 그러나 TCP/IP 주제만가지고도몇개의강좌를해야되므로, 자세한내용은다른서적이나강좌를참고하세요. 제가추천하는책은 TCP/IP

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

슬라이드 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

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

Microsoft PowerPoint PythonGUI-socket

Microsoft PowerPoint PythonGUI-socket : 채팅프로그래밍 순천향대학교컴퓨터공학과 이상정 순천향대학교컴퓨터공학과 1 학습내용 인터넷구조 인터넷구성요소 인터넷주소 클라이언트 / 서버구조 소켓프로그래밍소개 파이썬소켓프로그래밍 TCP 클라이언트 / 서버프로그래밍 스레드소개 파이썬스레드 채팅클라이언트 / 서버프로그램 순천향대학교컴퓨터공학과 2 네트워크요소 네트워크가장자리 (edge) 호스트 : 클라이언트와서버

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 중급소켓프로그래밍 (3) 네트워크프로그래밍 6 장 1 목차 제 6장중급소켓프로그래밍 6.1 소켓옵션 6.2 시그널 6.3 넌블로킹입 / 출력 6.4 멀티태스킹 6.5 멀티플렉싱 6.6 다수의수싞자처리 2 멀티태스킹 멀티태스킹이란? 사젂적의미 한사람의사용자가한대의컴퓨터로 2 가지이상의작업을동시에처리하거나, 2 가지이상의프로그램들을동시에실행시키는것 소켓에서의멀티태스킹

More information

Chapter #01 Subject

Chapter #01  Subject Device Driver March 24, 2004 Kim, ki-hyeon 목차 1. 인터럽트처리복습 1. 인터럽트복습 입력검출방법 인터럽트방식, 폴링 (polling) 방식 인터럽트서비스등록함수 ( 커널에등록 ) int request_irq(unsigned int irq, void(*handler)(int,void*,struct pt_regs*), unsigned

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

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

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

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-SEGMENT DEVICE CONTROL - DEVICE DRIVER Jo, Heeseung 디바이스드라이버구현 : 7-SEGMENT HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 디바이스드라이버구현 : 7-SEGMENT 6-Digit 7-Segment LED

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

SMB_ICMP_UDP(huichang).PDF

SMB_ICMP_UDP(huichang).PDF SMB(Server Message Block) UDP(User Datagram Protocol) ICMP(Internet Control Message Protocol) SMB (Server Message Block) SMB? : Microsoft IBM, Intel,. Unix NFS. SMB client/server. Client server request

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

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 KeyPad Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착 4x4 Keypad 2 KeyPad 를제어하기위하여 FPGA 내부에 KeyPad controller 가구현 KeyPad controller 16bit 로구성된

More information

1217 WebTrafMon II

1217 WebTrafMon II (1/28) (2/28) (10 Mbps ) Video, Audio. (3/28) 10 ~ 15 ( : telnet, ftp ),, (4/28) UDP/TCP (5/28) centralized environment packet header information analysis network traffic data, capture presentation network

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

/chroot/lib/ /chroot/etc/

/chroot/lib/ /chroot/etc/ 구축 환경 VirtualBox - Fedora 15 (kernel : 2.6.40.4-5.fc15.i686.PAE) 작동 원리 chroot유저 ssh 접속 -> 접속유저의 홈디렉토리 밑.ssh의 rc 파일 실행 -> daemonstart실행 -> daemon 작동 -> 접속 유저만의 Jail 디렉토리 생성 -> 접속 유저의.bashrc 의 chroot 명령어

More information

Network Programming

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

More information

Microsoft Word doc

Microsoft Word doc TCP/IP 구조 1. I.P 구조설명 2. ARP 구조설명 3. TCP 구조설명 4. UDT 구조설명 5. RIP 구조설명 6. BOOTP 구조설명 7. TFTP 구조설명 destination addr source addr type data CRC 6 6 2 46-1500 4 type 0X0800 IP datagram 2 46-1500 type 0X0806

More information

10. 시스템 프로그래밍

10.  시스템 프로그래밍 네트워크프로그래밍 Unix Network Programming, 2nd Ed., W. Richard Stevens, Prentice Hall PTR, 1999. 한국어판 Unix Network Programming, Stevens 저, 김치하, 이재용역, 대영사, 1991. 컴퓨터네트워크프로그래밍, 개정판, 김화종, 홍릉과학출판사, 2000. 10.7 소켓

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

OPCTalk for Hitachi Ethernet 1 2. Path. DCOMwindow NT/2000 network server. Winsock update win95. . . 3 Excel CSV. Update Background Thread Client Command Queue Size Client Dynamic Scan Block Block

More information

Network Programming

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

More information

슬라이드 1

슬라이드 1 -Part3- 제 4 장동적메모리할당과가변인 자 학습목차 4.1 동적메모리할당 4.1 동적메모리할당 4.1 동적메모리할당 배울내용 1 프로세스의메모리공간 2 동적메모리할당의필요성 4.1 동적메모리할당 (1/6) 프로세스의메모리구조 코드영역 : 프로그램실행코드, 함수들이저장되는영역 스택영역 : 매개변수, 지역변수, 중괄호 ( 블록 ) 내부에정의된변수들이저장되는영역

More information

제1장 Unix란 무엇인가?

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

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

chapter4

chapter4 Basic Netw rk 1. ก ก ก 2. 3. ก ก 4. ก 2 1. 2. 3. 4. ก 5. ก 6. ก ก 7. ก 3 ก ก ก ก (Mainframe) ก ก ก ก (Terminal) ก ก ก ก ก ก ก ก 4 ก (Dumb Terminal) ก ก ก ก Mainframe ก CPU ก ก ก ก 5 ก ก ก ก ก ก ก ก ก ก

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

TCP.IP.ppt

TCP.IP.ppt TCP/IP TCP/IP TCP/IP TCP/IP TCP/IP Internet Protocol _ IP Address Internet Protocol _ Subnet Mask Internet Protocol _ ARP(Address Resolution Protocol) Internet Protocol _ RARP(Reverse Address Resolution

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 (Host) set up : Linux Backend RS-232, Ethernet, parallel(jtag) Host terminal Target terminal : monitor (Minicom) JTAG Cross compiler Boot loader Pentium Redhat 9.0 Serial port Serial cross cable Ethernet

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

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

Microsoft PowerPoint - Lecture_Note_7.ppt [Compatibility Mode]

Microsoft PowerPoint - Lecture_Note_7.ppt [Compatibility Mode] Unix Process Department of Computer Engineering Kyung Hee University. Choong Seon Hong 1 유닉스기반다중서버구현방법 클라이언트들이동시에접속할수있는서버 서비스를동시에처리할수있는서버프로세스생성을통한멀티태스킹 (Multitasking) 서버의구현 select 함수에의한멀티플렉싱 (Multiplexing)

More information

Microsoft PowerPoint UnixNetProg.ppt [호환 모드]

Microsoft PowerPoint UnixNetProg.ppt [호환 모드] 유닉스네트워크프로그래밍 Unix Network Programming, 2nd Ed., W. Richard Stevens, Prentice Hall PTR, 1999. 한국어판 Unix Network Programming, 2nd Ed., W. Richard Stevens 저, 김치하, 이재용편역, 교보문고, 1999. 컴퓨터네트워크프로그래밍, 개정판, 김화종,

More information

# Old State Mew State Trigger Actions 1 - TCP/IP NOT CONNECTED Initialization 2 TCP/IP NOT HSMS NOT TCP/IP Connect Succeeds: CONNECTED SELECTED 1. TCP/IP "accecpt" succeeds. Start T7 timeout 1. Cancel

More information

Microsoft PowerPoint - Lecture_Note_2.ppt [Compatibility Mode]

Microsoft PowerPoint - Lecture_Note_2.ppt [Compatibility Mode] Understanding of Socket and File I/O Department of Computer Engineering Kyung Hee University. Choong Seon Hong 1 컴퓨터통신프로토콜 컴퓨터통신프로토콜데이터를원활이주고받을수있도록정한약속컴퓨터네트워크프로토콜 통신장비는서로간의통신방법이미리정의되어있어야함 같은통신프로토콜을지원하는장비간에만통신이가능컴퓨터통신은네트워크형태로운영

More information

Microsoft PowerPoint - UnixNetProg.ppt [호환 모드]

Microsoft PowerPoint - UnixNetProg.ppt [호환 모드] 유닉스네트워크프로그래밍 Unix Network Programming, 2nd Ed., W. Richard Stevens, Prentice Hall PTR, 1999. 한국어판 Unix Network Programming, 2nd Ed., W. Richard Stevens 저, 김치하, 이재용편역, 교보문고, 1999. 컴퓨터네트워크프로그래밍, 개정판, 김화종,

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

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

1. What is AX1 AX1 Program은 WIZnet 사의 Hardwired TCP/IP Chip인 iinchip 들의성능평가및 Test를위해제작된 Windows 기반의 PC Program이다. AX1은 Internet을통해 iinchip Evaluation

1. What is AX1 AX1 Program은 WIZnet 사의 Hardwired TCP/IP Chip인 iinchip 들의성능평가및 Test를위해제작된 Windows 기반의 PC Program이다. AX1은 Internet을통해 iinchip Evaluation 1. What is AX1 AX1 Program은 WIZnet 사의 Hardwired TCP/IP Chip인 iinchip 들의성능평가및 Test를위해제작된 Windows 기반의 PC Program이다. AX1은 Internet을통해 iinchip Evaluation Board(EVB B/D) 들과 TCP/IP Protocol로연결되며, 연결된 TCP/IP

More information

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 System call table and linkage v Ref. http://www.ibm.com/developerworks/linux/library/l-system-calls/ - 2 - Young-Jin Kim SYSCALL_DEFINE 함수

More information

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC Step 1~5. Step, PC, DVR Step 1. Cable Step

More information

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

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

More information

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS ( PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (http://ddns.hanwha-security.com) Step 1~5. Step, PC, DVR Step 1. Cable Step

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 C-구조체

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

More information

Sena Device Server Serial/IP TM Version

Sena Device Server Serial/IP TM Version Sena Device Server Serial/IP TM Version 1.0.0 2005. 3. 7. Release Note Revision Date Name Description V1.0.0 2005-03-7 HJ Jeon Serial/IP 4.3.2 ( ) 210 137-130, : (02) 573-5422 : (02) 573-7710 email: support@sena.com

More information