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 7765649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:13:03+00:00 2026-06-01T15:13:03+00:00

I want a Node JS server to communicate with a UDP or TCP client.

  • 0

I want a Node JS server to communicate with a UDP or TCP client.

My questions:

  1. What are the steps or suggestion when i want to create socket client with another language , but the server is using nodejs?
  2. I have created UDP client with java, but when i want to connect to the Node JS server, i couldn’t connect. I think in node js any something rule to connect to server, how your opinion?
  • 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-01T15:13:05+00:00Added an answer on June 1, 2026 at 3:13 pm

    TCP and UDP sockets are not language-dependant, if you have an UDP server in NodeJS, and an UDP Client in Java, this should work out of the box.

    So you must be doing something wrong in your NodeJS or Java program. Here’s a simple Hello world program :

    Server.js :

    var dgram = require("dgram");
    var server = dgram.createSocket("udp4");
    
    server.on("message", function (msg, rinfo) {
      console.log("server got: " + msg + " from " +
        rinfo.address + ":" + rinfo.port);
    });
    
    server.on("listening", function () {
      var address = server.address();
      console.log("server listening " +
          address.address + ":" + address.port);
    });
    
    server.bind(41234);
    // server listening 0.0.0.0:41234
    

    and UDPClient.java :

    import java.io.*;
    import java.net.*;
    
    class UDPClient 
    {
       public static void main(String args[]) throws Exception
       {
          DatagramSocket clientSocket = new DatagramSocket();
          InetAddress IPAddress =  InetAddress.getByName("localhost");
          byte[] sendData = new byte[1024];
          String sentence = "Hello World!";
          sendData = sentence.getBytes();
          DatagramPacket sendPacket =  new DatagramPacket(sendData, sendData.length, IPAddress, 41234);
          clientSocket.send(sendPacket);
          clientSocket.close();
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am going to make a client-server application using Node.js, and I want to
I want to copy the values of one node to another in sql server(2005
I want to create a simple long polling server in node.js where communication will
I am using node.js to build a tcp server, and I want to extract
I want to use dotcloud with node.js + socket.io for realtime applications. But they
I have simulated a browser client of socket.io in the node.js server I am
I want to create new node of BeanTreeView, and when I add some node
I want to create a native (c++) module for node.js which is able to
I'm new to node.js but I know it has a great socket API called
I have a windows server running IIS and node.js with socket.io for an interactive

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.