// sigaction() 함수 사용 예제 프로그램 #include #include #include #include #include static void sigint_handler(int signo) ; static void sigquit_handler(int signo) ; int main(void) { struct sigaction act_int, act_quit ; act_int.sa_handler = sigint_handler ; sigemptyset(&act_int.sa_mask) ; sigaddset(&act_int.sa_mask, SIGQUIT) ; act_int.sa_flags = 0; if ( sigaction(SIGINT, &act_int, NULL) < 0 ) { printf("sig..
* 시그널(signal) : 동작중인 프로세스에 영향을 끼치는 특정한 사건이 발생할 때 생성되는 신호 : 0으로 나누기 등과 같은 오류 발생, 자식 프로세스 종료와 타이머 종료, 그리고 사용자 프로세스에 의한 kill() 또는 raise() 함수 호출 등 다양한 사건에 의해 발생될 수 있고, 각 사건에 의해 발생됨 : SIG로 시작되는 고유한 이름을 가짐으로써 구분되어 처리 * 시그널의 처리 - 무시(SIG_IGN) : 시그널이 발생하더라도 해당 시그널을 무시, SIGKILL과 SIGSTOP을 제외한 대부분의 시그널에 적용 - 시그널 처리기(Signal Handler) 함수 수행 : 시그널 발생시 프로세스가 미리 등록한 시그널 처리기(함수)를 실행하도록 설정 - 기본 동적(SIG_DFL) 실행 : 각 시..
i n v i t a t i o n wait()함수를 사용한 좀비 프로세스 제어 프로그램 소스 오른쪽 툴바에서 소스 보기를 통해 소스를 복사하실 수 있어요^^ #include #include #include #include #include int main(void) { pid_t pid ; int i ; for ( i = 0 ; i < 5 ; i++ ) { switch ( pid = fork() ) { case -1 : printf("fork error\n") ; exit(-1) ; break ; case 0 : /* child process */ exit(0) ; break ; default : /* parent process */ break ; } } for ( i = 0 ; i < 5 ; i++ )..
좀비 프로세스(Zombie Process) : 부모가 자식 프로세스의 종료 상태를 접수하지 않아 할당된 메모리가 없는 상태로 유지되는 자식 프로세스 좀비 상태의 프로세스는 시스템 자원의 낭비를 초래 ( 해당 프로세스를 위한 제어 정보(프로세스 ID, CPU와 메모리 등의 자원 사용율 등) 부모 프로세스는 wait()와 waitpid()함수를 사용하여 자식 프로세스의 종료 상태를 접수 * wait()와 waitpid() 함수 형식 #include pid_t wait(int *statloc); pid_t waitpid(pid_t pid, int *statloc, int options); // 반환 : 성공시 프로세스 ID, 실패시 -1 // pid : 종료 확인을 원하는 자식 프로세스의 ID // statl..
다중 사용자 서버(Multi-user Server) : 불특정 다수의 클라이언트로부터 서비스 요청을 처리 - 반복 처리 서버(Iterative Server) - 동시 처리 서버(Concurrent Server) > 반복 처리 서버 - 간단하여 개발하기 쉽고 이해하기 쉬움 - 사용자가 많아질 경우 클라이언트가 서비스를 위해 대기할 수 있는 시간이 길어질 수 있음 > 동시 처리 서버 - 다수의 클라이언트로부터의 서비스 요청을 동시에 처리, 공정한 서비스 제공 다중 프로세스 기반의 동시 처리 서버 모델 - 다수 클라이언트의 요청을 처리하기 위해 LINUX환경에서 독립적인 작업 단위이자 시간 공유 기법으로 CPU에 의해 동시에 처리되는 다수의 프로세스를 활용 - 즉, 서버는 클라이언트로부터의 연결 설정 요청을 ..
getbyhostaddr() 함수 예제 소스 예제 소스를 첨부합니다. /* getbyhostaddr.c */ #include #include #include #include #include int main(int argc, char **argv) { struct hostent *hptr; struct sockaddr_in addr ; int i=0; if ( argc != 2 ) { printf("Type and \n") ; exit(1); } memset ( &addr, 0, sizeof(addr) ) ; addr.sin_addr.s_addr = inet_addr(argv[1]) ; hptr = gethostbyaddr( (char*)&addr.sin_addr , 4 , AF_INET); if ( !h..
/* fork_test.c */ #include #include #include #include int glob = 6 ; char buf[] = "a write to stdout\n" ; int main(void) { int var ; pid_t pid ; var = 88 ; if ( write (1, buf, sizeof(buf)-1) != sizeof(buf) -1 ) { printf("write error\n"); return -1; } printf("before fork\n"); if ( ( pid=fork()) < 0 ) { printf("fork error\n") ; return -1 ; } // 자식 프로세스인 경우 else if ( pid == 0 ) { glob++; var++; pri..
/* hello_world_server.c */ /* 아래 소스는 클라이언트로부터 연결 요청이 들어오면 이를 수락하여 서버 연결 소켓을 생성하고 클라이언트 소켓으로 Hello World 메시지를 보내고 연결을 종료하는 소스 */ #include #include #include #include #include #include #include void error_msg(char *message) ; int main(int argc, char ** argv) { int serv_sock ; int conn_sock ; struct sockaddr_in serv_addr ; struct sockaddr_in conn_addr ; int addr_len ; char message[] = "Hello World\n..
#include #include #include #include int main(int argc, char **argv) { struct hostent *hptr; char **aptr ; int i=0; hptr = gethostbyname(argv[1]); if ( argc != 2 ) { printf("Type and \n") ; exit(1); } if ( hptr == NULL ) { printf("gethostbyname() error!\n") ; } printf("Official Host Name : %s\n", hptr->h_name ) ; for ( i = 0 ; hptr->h_aliases[i] != NULL ; i++) printf("Alias Host Name : %s\n", hpt..
N e t w o r k P r o g r a m m i n g 파일/소켓 디스크립터(file/socket descriptor) 생성 예제 /* creat_socket.c */ #include #include #include #include #include #include int main() { int fd1, fd2, tcp_socket, udp_socket ; fd1 = open("test_file1", O_RDWR | O_CREAT, 0); tcp_socket = socket ( PF_INET, SOCK_STREAM, 0); fd2 = open("test_file2", O_RDWR | O_CREAT, 0); udp_socket = socket ( PF_INET, SOCK_DGRAM, 0); // p..
- Total
- Today
- Yesterday
- W3Schools Online Web Tutorials
- 구차니의 잡동사니 모음
- [IT]블로거팁닷컴
- 비앤아이님의 블로그
- Blog Suspect
- 즐거운하루 blog
- zinicap의 검색엔진 마케팅(SEM)
- 머니야머니야님의 블로그
- [Friend] AtinStory
- [기타배우기]해브원 박스
- [웹표준] SINDB.com
- 해커 C 이야기
- [애드센스] 길라잡이
- 정순봉의 IT SCHOOL
- 씨디맨의 컴퓨터이야기
- 2proo Life Story
- 못된준코의 세상리뷰
- [IT강좌] 정보문화사
- IN 대전
- 에우르트는 나쁜남자 -_-
- 씬의 싱크탱크
- 엔돌슨의 IT이야기
- 진이늘이
- 'Cooltime'의 블로그
- 후이의 Tistory
- Soulstorage
- 앤드&엔드의 블로그
- June Blog
- 노지의 소박한 이야기
- gbWorld
- 인터넷 속 나의 생각
- HarshNix
- ART of WEB
- 녹두장군 - 상상을 현실로
- C언어 문제
- 강좌
- 프로그래밍 문제
- 소스
- MBTI
- 소스코드
- C
- JavaScript
- 예제 소스
- MBTI 강좌
- MBTI 검사
- 성공
- 안드로이드 어플 추천
- MBTI 테스트
- C언어 소스
- 인터넷
- 강의
- It
- 효과음
- MBTI 자료
- 안드로이드
- 프로그래밍
- 인터넷 익스플로러
- 리뷰
- HTML
- C언어
- 모토로이
- 안드로이드 어플
- php
- 스마트폰
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |