소켓 생성의 최대 한계는 어디까지?

익명 사용자의 이미지

안녕하세요..

오늘 소켓복습을 하다가 이런 문제가 있어서 궁금해서 자문을 구하고자 합니다.소켓은 1024 이상 생성되지 않은 것 같은데요.

모든 유닉스, 리눅스에서 이게 표준인가요.

궁금합니다. 누가 비슷한 질문을 올려서 그렇게 해본 결과값은

[root@sori etc]# sysctl -a | grep fs.file-max
fs.file-max = 8192

라고 나온데 실제로 생성해보면 1024 이상 안됩니다.

소스는 간단합니다.

----------------------------------------
#include
#include
#include
#define MAX 100000

int main() {
int sd[MAX];
int i;

for(i=0; i < MAX; i++) {
if((sd[i]=socket(PF_INET,SOCK_STREAM,0)) < 0) {
printf("can't create socket %d",i);
exit(0);
}
printf("socket number %d\n",sd[i]);
sleep(1);
}
}

----------------------------------------

읽어주셔서 감사합니다.

익명 사용자의 이미지

[root@baram4x net]# ulimit -a
core file size (blocks) 0
data seg size (kbytes) unlimited
file size (blocks) unlimited
max locked memory (kbytes) unlimited
max memory size (kbytes) unlimited
open files 1024
pipe size (512 bytes) 8
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 511
virtual memory (kbytes) unlimited

[root@baram4x net]# ulimit -n 8000

[root@baram4x net]# ulimit -a
core file size (blocks) 0
data seg size (kbytes) unlimited
file size (blocks) unlimited
max locked memory (kbytes) unlimited
max memory size (kbytes) unlimited
open files 8000
pipe size (512 bytes) 8
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 511
virtual memory (kbytes) unlimited