Java to Winsock services written in VB

J

jeffotn

I am familar with Java Sockets programming but not so much when it
comes to integrating with VB applications. My issues revolves around
apparent program hanging (i get no error message) when trying to
receive a reply from the program. If i got an exception that would be
something i can trouble shoot, but I really get nothing. I analyze
working VB that uses Winsock to communicate with the service

Java Code Fragment:
Socket s = new Socket("10.16.1.146", 5691); //fake port and ip dont
worry
InputStream is;
OutputStream os;
try {
is = s.getInputStream();
os = s.getOutputStream();

//Roedy Green litte-endian big-endian code
LEDataOutputStream los = new LEDataOutputStream(os);

los.writeBytes("00000003079010020060719"); //data request should
return some message
los.flush();

LEDataInputStream lis = new LEDataInputStream(is);
byte buffer = lis.readByte() //seem to hang

}catch (Exception) {
//print exception
}
End code framgement

One concern is if the the Services running on that port requires a
userid and password but I would expect a Connection Refuse Exception.

Hopefully the community can point me in the right direction thanks.

Jeff
 
C

Chris Uppal

I am familar with Java Sockets programming but not so much when it
comes to integrating with VB applications. My issues revolves around
apparent program hanging (i get no error message) when trying to
receive a reply from the program. If i got an exception that would be
something i can trouble shoot, but I really get nothing.

I can't help with the specific problem, but in general if you have a network
problem and are not using a network sniffer/analyser such as Ethereal (free
from http://www.ethereal.com ), then you are just wasting your own time.

-- chris
 
J

jeffotn

Thanks for the suggestion, I will do that, its funny if I had access to
the raw source or an api on the process that gets interrograted by the
service running on that port, I would have a 100% java solution but
unfortunately i do not. At the end of the day I just want some bytes.
I will run the back sniffer and see if it helps. But I still am
looking for someone very familiar with Java sockets and security to
give me some pointers.
 
E

EJP

I am familar with Java Sockets programming but not so much when it
comes to integrating with VB applications. My issues revolves around
apparent program hanging (i get no error message) when trying to
receive a reply from the program.

You don't say which way round the application is, but are you calling
flush() before reading at the Java end?
 
J

jeffotn

I am calling flush (los.flush() is a wrap to flush()). The issue was
resolved. The service had performance issues when a request was made
for data from 15 days or more in the past from todays date. So i guess
the socket just timed out after a while with no exception.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top