File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Error connecting to server running on VB! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Error connecting to server running on VB!" Watch "Error connecting to server running on VB!" New topic

Error connecting to server running on VB!

Jd Steven

Joined: Oct 04, 2004
Posts: 5
I have a java program that opens a new socket connection to the server (where VB application is listening) and then sends some data. The VB application is supposed to receive it and then send some other data back to the java client, which is now reading input stream. However, everytime I try to read from input stream it returns me -1 . Can anyone suggest anything please? Following is my code. fyi: Its part of client migration from VB to Java (server is still VB). The VB client works perfectly for the same using winsock but java doesnt

outStr.write(vgBufferOut); //write bytes array to output stream


inStr = socket.getInputStream(); //get input stream

vlLenbufferIn =; //read

System.out.println("Length is " + vlLenbufferIn); //this always returns -1 - end of stream
I agree. Here's the link:
subject: Error connecting to server running on VB!