#include #include #include #include #include #include #include #include #include #include #include #include int main() { // 이더넷 데이터 구조체 struct ifreq *ifr; struct sockaddr_in *sin; struct sockaddr *sa; // 이더넷 설정 구조체 struct ifconf ifcfg; int fd; int n; int numreqs = 30; fd = socket(AF_INET, SOCK_DGRAM, 0); // 이더넷 설정정보를 가지고오기 위해서 // 설정 구조체를 초기화하고 // ifreq데이터는 ifc_buf에 저장되며, // 네트워크 장치가 여러개 있을 수 있으므..
리눅스에서 프로그래밍할때 IntelliJ 기반의 CLion이라는 툴을 사용해보았다. CLion은 Makefile이 아닌 범용 maketool인 CMake를 사용한다. 그래서 Makefile 대신에 CMakeLists.txt를 만들어줘야 빌드가 된다. 1. 아래는 long string에 대한 에러가 날때 사용한다. CFLAGS옵션 이다.MakefileFLAGS = -g -O3 -fpermissive -w CMakeLists.txtset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") 2. 아래는 include directory에 대해서 설정이다. I옵션이다.MakefileINCS = -I/usr/include -I/usr/local/mysql/include -I/..
#include #include #include #include #include #include #include #include #include #include #define MAXEVENTS 64 static int make_socket_non_blocking(int sfd) { int flags, s; flags = fcntl(sfd, F_GETFL, 0); if (flags == -1) { perror("fcntl"); return -1; } flags |= O_NONBLOCK; s = fcntl(sfd, F_SETFL, flags); if (s == -1) { perror("fcntl"); return -1; } return 0; } static int create_and_bind(char *po..
좋은 글이 있어서 퍼왔다. 소켓에서 리눅스에서는 4000이하일때 select도 쓸만하다는게 맞는말 같다. http://nomoreid.egloos.com/3137280 뭐 잘알려진 사실들 이지만 그냥 개인적인 정리입니다. 이상한 부분이나 태클 환영합니다.1. 라이센스 문제를 피하고 싶다면 cent os를 추천한다. (http://www.centos.org/). 뭐 다들 아는 이야기 겠지만 리눅스에도 상용 배포판이 따로 있다. 하지만 상용 서비스라고 해서 상용 OS를 써야 하는건 아니다. cent os는 재미있게도 상용 배포판인 Red Hat Enterprise Linux(보통 줄여서 RHEL이라고 부른다) 의 클론에서 출발한 프로젝트이다. 바이너리 레벨에서 호환된다. 또 거의 모든 셋팅이 동일하다. 그리..
- Total
- Today
- Yesterday