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

  • Home
  • SEARCH
  • 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 8719511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:48:58+00:00 2026-06-13T06:48:58+00:00

I try to learn TCP/IP and as an exercise I have developed a LAN

  • 0

I try to learn TCP/IP and as an exercise I have developed a LAN host discovery utility like http://overlooksoft.com.

After crawling the web, I’ve found nmap utility which do this job.

I have made this small test:

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;

public class NetDiscovery {
   public static void main( String[] args ) throws Throwable {
      DatagramChannel channel = DatagramChannel.open();
      channel.bind(
         new InetSocketAddress( InetAddress.getByName( "192.168.1.7" ), 2416 ));
      ByteBuffer      buffer  = ByteBuffer.allocate( 1024 );
      SocketAddress   address =
         new InetSocketAddress( InetAddress.getByName( "192.168.1.255" ), 80 );
      channel.send( buffer, address );
      SocketAddress sender = channel.receive( buffer ); // <<<<<<<<<<<<<<<<<<<<
      System.err.println(
         ((InetSocketAddress)sender).getAddress().getHostAddress());
   }
}

I expect some response to this “udp ping broadcast” by the other hosts (4) on my LAN but this program waits indefinitely in the line marked with // <<<<<<<<<<<<<<<<<<<<

Why?

  • 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-13T06:49:00+00:00Added an answer on June 13, 2026 at 6:49 am

    UDP doesn’t work like that. Unless something on those other machines is bound to UDP port 80, and responding, nothing would happen. The datagrams are just lost. Other machines probably send ICMP “port unreachable” messages, but since you can’t really connect to broadcast address, you get nothing at the UDP level.

    If you don’t want anything deployed on other machines, then ICMP is probably your best option. Otherwise look into multicast and maybe zeroconf.

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

Sidebar

Related Questions

I am using org.aspectj.lang.annotation.Pointcut . I have an interface com.home.learn.Try. I want a pointcut
I try to learn REST in Ruby using Twitter API. According https://dev.twitter.com/docs/api/1/get/trends I have
I am working with this example to try and learn Sencha Touch. I have
Hello I'm very new to OpenGlES and i have started to try to learn
I am following this tutorial http://static.springsource.org/docs/Spring-MVC-step-by-step/part4.html to try and learn Spring. Everything worked fine
I try to learn Spring. I am following this site http://www.roseindia.net/spring/spring3/spring-3-hello-world.shtml I tried one
I'm using macincloud service to try/play/learn about building iPhone apps. I have a dummy
Some projects that I try and learn from don't have a schema.rb file, why
I have this simple C code that try to connect to www host by
I am just beginning to try to learn C and have been trying to

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.