Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8213689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:12:18+00:00 2026-06-07T11:12:18+00:00

Is this even possible? I have a java server program on a mac that

  • 0

Is this even possible? I have a java server program on a mac that I need to use to communicate back to a windows program. I have the client working in Java, but I can’t seem to figure out how to get it to work in VB.net…

Here is the Java code…

import java.io.*;
import java.net.InetAddress;
import java.net.Socket;

public class socketClient {

public static void main(String[] args) {
    /**
     * Define a host server
     */
    String host = "10.1.1.194";
    /**
     * Define a port
     */
    int port = 19999;

    StringBuffer instr = new StringBuffer();
    String TimeStamp;
    System.out.println("SocketClient initialized");

    try {

         //Obtain an address object of the server
        InetAddress address = InetAddress.getByName(host);


        //Establish a socket connection
        Socket connection = new Socket(address, port);

        //Instantiate a BufferedOutputStream object  
        BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());

        /**
         * Instantiate an OutputStreamWriter object with the optional
         * character encoding.
         */
        OutputStreamWriter osw = new OutputStreamWriter(bos, "US-ASCII");

        TimeStamp = new java.util.Date().toString();
        String process = "Initiate file transfer on " + host + " port " + port
                + " at " + TimeStamp + (char) 13;

        //Write across the socket connection and flush the buffer
        osw.write(process);
        osw.flush();


        /**
         * Instantiate a BufferedInputStream object for reading /**
         * Instantiate a BufferedInputStream object for reading incoming
         * socket streams.
         */
        BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
        /**
         * Instantiate an InputStreamReader with the optional character
         * encoding.
         */
        InputStreamReader isr = new InputStreamReader(bis, "US-ASCII");


        //Read the socket's InputStream and append to a StringBuffer
        int c;
        while ((c = isr.read()) != 13) {
            instr.append((char) c);
        }

        //Close the socket connection.
        connection.close();
        System.out.println(instr);
    } 
    catch (IOException f) 
    {
        System.out.println("IOException: " + f);
    } 
    catch (Exception g) 
    {
        System.out.println("Exception: " + g);
    }
}
}

And here is my VB.NET code that I have so far…

Private clientSocket As Socket
Private host As String = "10.1.1.194"
Private port As Integer = 19999

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

    Try


        Dim add As New IPEndPoint(IPAddress.Parse(host), port)

        clientSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

        clientSocket.Connect(add)

        Dim netStream As New NetworkStream(clientSocket, True)



        Dim outstream As Byte() = System.Text.Encoding.ASCII.GetBytes("Initiate file transfer from " _
        & System.Environment.MachineName & " on " & host & " port " & port & " at " & TimeOfDay)


        netStream.Write(outstream, 0, outstream.Length)
        netStream.Flush()

    Catch ex As Exception
        Debug.Write(ex.Message)
    End Try


    End Sub

Now, if I run the vb code, it hangs… and nothing appears in my console on the mac (Like it does when I use the java client), however, when I close the VB code, I get the java.net.SocketException: Connection reset error, so I must be getting pretty close to figuring this out.

The thing is, I know almost nothing when it comes to socket programming, so if someone could push me in the right direction, it would be very appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:12:20+00:00Added an answer on June 7, 2026 at 11:12 am

    Is this even possible?

    Yes.

    I don’t see you writing Carriage Return (13) character anywhere in your VB.NET example, yet you expect it to appear on a Java side in order to print something to the console.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is this even possible? I have a key-pair that I already made with GPG
I have no idea how this works or if it is even possible but
Im having issues getting this to work, maybe its not even possible? I have
I have a website (python/django) that needs to use a load of Java resources
I have a java client which is managing its server calls in new threads
I have a multi-threaded server that handles client requests, and makes new threads for
Is this even possible? function foo() { // do stuff } foo.prototype = {
Is this even possible? Basically, I want to turn these two calls to sub
Is this scenario even possible? class Base { int someBaseMemer; }; template<class T> class
I'm not sure this is even possible but I know if it is, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.