|
||
|
|||
|
I have two applications running on the same computer. They are to converse with each other via TCP/IP sockets.
Application 1 is a second party application and I have no control over how it handles IO. It has two connections 1 is a write port and the other a listen port and when it is connecting to applications on the same computer then the ports cannot be the same. Application 2 is my Java application that is to receive data from and pass data to Application 1. It accepts the connection of Application 1 by using a ServerSocket.accept() method. However there is a problem when I attempt to create a Socket that connects to the listen port of Application 1. When I attempt to create the second socket the socket that is created from the ServerSocket.accept() closes or stops the InputStream. I need to have way for Application 2 to listen to the port that Application 1 writes to and write to the port that Application 1 listens to and they must be able to handle this at the same time. Does anyone know what I could be doing wrong? Here's an example of what I'm seeing: Code: ServerSocket receiver = null; Socket socket1 = null; Socket socket2 = null; try { receiver = new ServerSocket(6001); socket1 = receiver.accept(); // here I would start handling socket1.getInputStream(); socket2 = new Socket("172.10.10.21", 6002); // the line above breaks the InputStream from socket1 } catch(Exception e) { }
|
![]() |
| Tags |
| inputstream, serversocket, socket |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| for chat application, is it necessary sockets and mutithreading in servlets? | chinni | Java Servlet | 1 | 20-10-2009 11:31 AM |
| java application connecting to a server | wildheart25c | Java Networking | 2 | 17-09-2009 12:22 PM |
| Help about connecting DB to java! | java_cs | JDBC & Databases | 1 | 11-09-2009 05:39 PM |
| connecting two classes? | chronoz13 | Object Oriented Programming | 9 | 01-09-2009 08:15 PM |
| Connecting to Oracle from within Eclipse | kairamr | Java IDEs | 1 | 12-11-2008 09:16 PM |
|
100 most searched terms
Search Cloud
|
| 2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jbutton java jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? |