Networking - How does the .accept() method work?

Hi,

I have checked the source code of the ServerSocket implementation that comes with the jdk.

I tought I was going to find some type of loop. However I found nothing like that! so how does the accept method work.

I mean when we call the .accept() method, the thread in which the socketServer is initialized gets stoped untill a new client connection is recieved! how is this actually managed?

Regards,

Sim085

[446 byte] By [sim085a] at [2007-11-26 23:16:49]
# 1
It blocks inside the kernel's TCP/IP stack in a 'C' method of the same name.
ejpa at 2007-7-10 14:17:47 > top of Java-index,Core,Core APIs...
# 2
At a guess, the accept call that Java makes, relies on the OS system call through JNI. accept would then block until a new connection is present if you are using blocking.
tabbya at 2007-7-10 14:17:47 > top of Java-index,Core,Core APIs...
# 3
Thanks :) I understand now :)Regards,Sim085
sim085a at 2007-7-10 14:17:47 > top of Java-index,Core,Core APIs...