Click to See Complete Forum and Search --> : java receive data from visual basic 6.0
Justa Lol
Aug 8th, 2009, 04:19 PM
i made a server in java and now when i send data from visual basic, nothing happens because i have no method to receive the data and i would like to get one. i tried google and found nothing.
how to receive data in java from vb?
kfcSmitty
Aug 8th, 2009, 05:42 PM
How are you sending the data and how are you attempting to receive it?
Are both the programs running on the same server? I assume not since you mention you're using java on your server. You may want to look into web services.
Justa Lol
Aug 8th, 2009, 07:38 PM
the server is programmed in java, i send data from vb6 with winsock by using a code like this: winsock1.sendData(data)
and i want the server to read the data and print it to the console.
ComputerJy
Aug 9th, 2009, 04:35 PM
use Server Sockets.. There are lots of tutorials online. Just google the topic
Justa Lol
Aug 10th, 2009, 08:08 AM
incase you didnt read what i wrote: "i tried google"
ComputerJy
Aug 10th, 2009, 08:35 AM
So you've seen these results (http://www.google.com/search?q=java+server+sockets+tutorial) and non of them works for you
Justa Lol
Aug 11th, 2009, 02:01 PM
i quit searching for this now, google wont show the same results up for every computer.
everything i want is just to get the message from the client.
ComputerJy
Aug 11th, 2009, 03:17 PM
Ok, this code should work. I haven't tried it and I'm not sure if it's exactly what you need.import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
public class Test {
public static void main(final String[] args) throws IOException {
final ServerSocket serverSocket = new ServerSocket(1234);
serverSocket.setReceiveBufferSize(1024 * 8);
final BufferedReader reader = new BufferedReader(new InputStreamReader(
serverSocket.accept().getInputStream()));
final StringBuffer buffer = new StringBuffer();
while (reader.ready())
buffer.append(reader.readLine() + "\n");
System.out.println(buffer.toString());
}
} But I still hope its useful
Justa Lol
Aug 12th, 2009, 11:37 AM
not sure, when i connect to it, the program stops running and says "press a key to continue..." or something like that and stops running.
ComputerJy
Aug 12th, 2009, 12:21 PM
I forgot to mention that 1234 is the port number. Feel free to change it to whatever appropriate.
Justa Lol
Aug 12th, 2009, 04:00 PM
i know that... i changed the port to the one i want to and when i connect to the server with my client, the server stops running.
maryjohn
Sep 16th, 2009, 05:10 AM
Hello budy..
i have one suggestion for this situation, u should write send method from server which is coded in java and write get method at client side which is coded in VB language, yet i have never tried it but just find more solution from www.sun.com, if any problem occure.
Justa Lol
Oct 6th, 2009, 04:02 PM
good idea... almost gave up hope making this...
thanks
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.