Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sam Yim
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic