File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Sockets: Creating more than one client (opening Socket connections) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Sockets: Creating more than one client (opening Socket connections)" Watch "Sockets: Creating more than one client (opening Socket connections)" New topic
Author

Sockets: Creating more than one client (opening Socket connections)

Sam Yim
Greenhorn

Joined: Jul 25, 2009
Posts: 17
I'm running a test to see how long it takes to get a Socket instance and I don't understand why the first seems to take about 10-15ms.
When I create new instances, i always get 0ms.

Anyone knows if there is some kind of caching that is happening?


time=02-25-2013.02.46.31.598|clientID_02.46.31.583_4|Socket(207501684) creation elaspeTime(ms)=12
time=02-25-2013.02.46.31.599|clientID_02.46.31.583_4|PrintWriter creation elaspeTime(ms)=0
time=02-25-2013.02.46.31.600|clientID_02.46.31.583_4|BufferedReader creation elaspeTime(ms)=0
time=02-25-2013.02.46.31.600|clientID_02.46.31.583_4|getData() elaspeTime(ms)=17
time=02-25-2013.02.46.31.601|clientID_02.46.31.583_4|Closing: socket[207501684] reader[56264551] writer[745503977]

time=02-25-2013.02.46.33.583|clientID_02.46.31.583_4|Socket(592598094) creation elaspeTime(ms)=0
time=02-25-2013.02.46.33.583|clientID_02.46.31.583_4|PrintWriter creation elaspeTime(ms)=0
time=02-25-2013.02.46.33.583|clientID_02.46.31.583_4|BufferedReader creation elaspeTime(ms)=0
time=02-25-2013.02.46.33.584|clientID_02.46.31.583_4|getData() elaspeTime(ms)=0
time=02-25-2013.02.46.33.584|clientID_02.46.31.583_4|Closing: socket[592598094] reader[1165259232] writer[1608535231]

time=02-25-2013.02.46.35.583|clientID_02.46.31.583_4|Socket(1703916023) creation elaspeTime(ms)=0
time=02-25-2013.02.46.35.583|clientID_02.46.31.583_4|PrintWriter creation elaspeTime(ms)=0
time=02-25-2013.02.46.35.584|clientID_02.46.31.583_4|BufferedReader creation elaspeTime(ms)=0
time=02-25-2013.02.46.35.584|clientID_02.46.31.583_4|getData() elaspeTime(ms)=1
time=02-25-2013.02.46.35.584|clientID_02.46.31.583_4|Closing: socket[1703916023] reader[2077638201] writer[781143987]

time=02-25-2013.02.46.37.583|clientID_02.46.31.583_4|Socket(1739421607) creation elaspeTime(ms)=0
time=02-25-2013.02.46.37.583|clientID_02.46.31.583_4|PrintWriter creation elaspeTime(ms)=0
time=02-25-2013.02.46.37.583|clientID_02.46.31.583_4|BufferedReader creation elaspeTime(ms)=0
time=02-25-2013.02.46.37.584|clientID_02.46.31.583_4|getData() elaspeTime(ms)=1
time=02-25-2013.02.46.37.584|clientID_02.46.31.583_4|Closing: socket[1739421607] reader[2011117821] writer[1612097414]

time=02-25-2013.02.46.39.583|clientID_02.46.31.583_4|Socket(304933128) creation elaspeTime(ms)=0
time=02-25-2013.02.46.39.583|clientID_02.46.31.583_4|PrintWriter creation elaspeTime(ms)=0
time=02-25-2013.02.46.39.583|clientID_02.46.31.583_4|BufferedReader creation elaspeTime(ms)=0
time=02-25-2013.02.46.39.583|clientID_02.46.31.583_4|getData() elaspeTime(ms)=0
time=02-25-2013.02.46.39.584|clientID_02.46.31.583_4|Closing: socket[304933128] reader[1870277025] writer[1027818036]

time=02-25-2013.02.46.41.583|clientID_02.46.31.583_4|Socket(2773808) creation elaspeTime(ms)=0
time=02-25-2013.02.46.41.583|clientID_02.46.31.583_4|PrintWriter creation elaspeTime(ms)=0
time=02-25-2013.02.46.41.583|clientID_02.46.31.583_4|BufferedReader creation elaspeTime(ms)=0
time=02-25-2013.02.46.41.583|clientID_02.46.31.583_4|getData() elaspeTime(ms)=0
time=02-25-2013.02.46.41.583|clientID_02.46.31.583_4|Closing: socket[2773808] reader[54270722] writer[1594958326]
 
jQuery in Action, 2nd edition
 
subject: Sockets: Creating more than one client (opening Socket connections)
 
Similar Threads
Help with Chat software
Threaded Application won't run.
Best way for login authentication
Socket problem
Socket answer in multiple parts, Client receive only 1