Results 1 to 13 of 13

Thread: java receive data from visual basic 6.0

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    java receive data from visual basic 6.0

    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?

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: java receive data from visual basic 6.0

    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.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: java receive data from visual basic 6.0

    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.

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: java receive data from visual basic 6.0

    use Server Sockets.. There are lots of tutorials online. Just google the topic
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: java receive data from visual basic 6.0

    incase you didnt read what i wrote: "i tried google"

  6. #6
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: java receive data from visual basic 6.0

    So you've seen these results and non of them works for you
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: java receive data from visual basic 6.0

    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.

  8. #8
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: java receive data from visual basic 6.0

    Ok, this code should work. I haven't tried it and I'm not sure if it's exactly what you need.
    Code:
    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
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: java receive data from visual basic 6.0

    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.

  10. #10
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: java receive data from visual basic 6.0

    I forgot to mention that 1234 is the port number. Feel free to change it to whatever appropriate.
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: java receive data from visual basic 6.0

    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.

  12. #12
    New Member
    Join Date
    Sep 2009
    Posts
    3

    Re: java receive data from visual basic 6.0

    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.

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: java receive data from visual basic 6.0

    good idea... almost gave up hope making this...

    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width