1

My specific problem is I have a tomcat comet servlet that my java application connects to. For some reason, I am getting random END events and I cant figure out why. I wonder, as Im trying to weed out whats not wrong, is if windows when connecting to the same ip and port, from within the same jvm, would give two processes the same port? This would make it look like to the server that the connection is coming from the same place? Does it work this way? I open two instances of the application from netbeans, the same JVM, and Im wondering if this can occur?

yemista
  • 433
  • 5
  • 15
  • I guess you need to change the port no. for both processes to pass data-on,not sure though. Why don't you try and check by just changing the port number!!! – Am_I_Helpful Aug 05 '14 at 02:28

2 Answers2

2

I wonder, as Im trying to weed out whats not wrong, is if windows when connecting to the same ip and port, from within the same jvm, would give two processes the same port?

No. Windows will always allocate a new local port for outbound connections.

This would make it look like to the server that the connection is coming from the same place? Does it work this way?

No.

I open two instances of the application from netbeans, the same JVM, and Im wondering if this can occur?

No.

The bug referred to in @TapanPandya's answer concerns ServerSockets and explicit bind() invocations. It isn't relevant to outbound connections.

user207421
  • 305,947
  • 44
  • 307
  • 483
-1

There was a bug in Java 7 some time back which allowed multiple applications to use same port. JDK-7179799. Also, check similar question Can two applications listen to the same port

Community
  • 1
  • 1
Tapan Pandya
  • 114
  • 2
  • 1
    Two programs listening at a specific port has nothing to do with what Windows does when allocating a system-allocated outbound port. – user207421 Aug 05 '14 at 05:06