blocking sockets question

Hi all,i am developing an application that will listens on two ports e.g port 25 and 143 how to make my application change its behaviour according to the connection that will come on which port? "i think this is called blocking sockets right" can any body help me please thanks alot
[299 byte] By [Radi0Shacka] at [2007-10-2 19:47:37]
# 1
I dont think i understand what you're asking. You'll have to open a ServerSocket for each port you want to listen to. It being blocking IO has little to do with it.
remonvva at 2007-7-13 22:26:19 > top of Java-index,Archived Forums,Socket Programming...
# 2

hi,

i mean lets say the first line of code is making socketserver to listen on port 25

and the second line is making another socketserver to listen on port 143, but if no connection cam to the first socketserver "25" the execution will never reach the second line "socketserver listening on port 143" this is called blocking but i want this part to be non blocking sockets can you help me any body?

thanks again :0

Radi0Shacka at 2007-7-13 22:26:19 > top of Java-index,Archived Forums,Socket Programming...
# 3
You will certainly have to have two accepting threads, one per ServerSocket, and they will have to spawn a new thread per accepted socket too.
ejpa at 2007-7-13 22:26:19 > top of Java-index,Archived Forums,Socket Programming...
# 4
thanks for reply can u show me a piece of code or a tutorial to read? thanks alot
Radi0Shacka at 2007-7-13 22:26:19 > top of Java-index,Archived Forums,Socket Programming...
# 5
There is a Sockets tutorial in the JDK, see the Guide to Features/Networking.
ejpa at 2007-7-13 22:26:19 > top of Java-index,Archived Forums,Socket Programming...
# 6
hi again can any body show me a piece of code as an example ?
Radi0Shacka at 2007-7-13 22:26:19 > top of Java-index,Archived Forums,Socket Programming...
# 7
There is some example code in the Sockets tutorial in the JDK, see the Guide to Features/Networking.Obviously you haven't looked for some reason.
ejpa at 2007-7-13 22:26:19 > top of Java-index,Archived Forums,Socket Programming...