조각 코드 : sizeof로 배열의 행과 열 크기를 알아내기

조각 코드 sizeof 연산자(int main(int argc, char argv){ int a; printf("rows printf("cols return 0;}실행결과$ ./sizeofrows cols 차원에 관계없이 크기를 알아낼 수 있도록 일반화된 함수를 만들어 낼 수 있을 것이다. ...

serial echo 예제

serial echo 예제이것은 간단히 Serial 통신을 하는 예제입니다. serial로부터 받은 데이터를 고스란히 다시 반향하여 보내는 것입니다.현재 코드는port=COM1 ("/dev/ttyS0") baud=9600 parity=true stop=1 data=8bit 로 만들어져 있습니다./ Copyright (C) Information Equip...

SEED 블록 암호화 library/example

SEED 블록 암호화 library/example---- 1. SEED 블록 암호화 library/example 1. 정보보호진흥원에서 개발한 SEED 알고리즘의 활용예 1. 1. Version 0.1 1. 2006/04/07 ----정보보호진흥원(KISA) 에서 개발한 SEED 암호화 알고리즘을library로 구현해보고 예제도 함께 만들어 봤습니다.기...

atox 함수 구현

atox 함수 구현네트웍프로그램 중 아래의 함수를 사용해야 해서 작성 한 적이 있습니다.(radius 관련)my_atox(aa, bb);int my_atox(char bis, char sib) / ascii to hex by HLIM /{ char p, b; char a; int i, sib_len, cnt; p = sib; b = bis; sib_len...

파일을 비봉쇄 - nonblocking -로 만들기

파일을 비봉쇄 - nonblocking -로 만들기파일을 비봉쇄로 만든다.int nonblock(int sockfd){ int opts; opts = fcntl(sockfd, F_GETFL); if(opts < 0) { return -1; } opts = (opts | O_NONBLOCK); if(fcntl(sockfd, F_SETFL, opts) < 0...

whitespace 문자 제거

whitespace 문자 제거#include #include char trim(char src, char dsc){ int i; char org; org = src; while(src) { if (!isspace(src)) { break; } else { src++; } } memcpy(dsc, src, strlen(sr...

조각 코드 : 네트워크 연결 정보 가져오기

조각 코드 리눅스의 proc 파일시스템을 분석해서 network 연결 정보를 가져온다. 정보는 netstat 명령이 보여주는 것과 비슷하다. 분석 파일 시스템은 /proc/net/tcp 이다.#include #include #include #include #include <...

ICMP Ping 구현 - minzn

ICMP Ping 구현 - minzn완전한 ping 은 아닙니다. 정말로 최소구현입니다.이것은 sid 가 걸려있거나 root 유저에서 실행가능합니다. 이유는 RAW socket 이기 때문입니다. / Copyright (c) Information Equipment co.,LTD. Code by JaeHyuk Cho

네트워크 인터페이스 정보 얻기

네트워크 인터페이스 정보 얻기미완성미완성 코드임#include #include #include #include #include #include #include #include #in...

조각 코드 : icmp 응답시간 체크

조각 코드 목적 서버에 대한 ICMP(int main(int argc, char argv){ int sockfd; int ip; struct timeval atime; struct sockaddr_in addr; sockfd = IcmpInit(); ip = CheckIcmp(sockfd, argv, &atime, &addr); printf("%s --...