aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes how to build a LAN testing software using java network programming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "how to build a LAN testing software using java network programming" Watch "how to build a LAN testing software using java network programming" New topic
Author

how to build a LAN testing software using java network programming

Sumit Kumar Yadav
Greenhorn

Joined: Aug 25, 2013
Posts: 23
sir, i want to build a simple LAN tester with the help of java socket programming. Since i do not know even how to begin with that... although i know how to do socket programming in java (not very sophisticated programs).
please help me out, from where do i begin what to do and how to check LAN connection status.
Do i have to send a file from one computer to another(basically server & client) and then to check the bandwidth speed or i have to do something else ?? since i am a newbie so i do not know much. please help
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19074
    
  40

Sumit Yaduvanshi wrote:sir, i want to build a simple LAN tester with the help of java socket programming. Since i do not know even how to begin with that... although i know how to do socket programming in java (not very sophisticated programs).
please help me out, from where do i begin what to do and how to check LAN connection status.
Do i have to send a file from one computer to another(basically server & client) and then to check the bandwidth speed or i have to do something else ?? since i am a newbie so i do not know much. please help


That depends... What are you trying to test? TCP or UDP? Unicast or Multicast? Connectivity? Packet loss? Latency? Throughput? Etc.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
What, exactly, do you mean by "LAN tester" and "check LAN connection status"? What are the inputs, and what are the outputs of each?
Sumit Kumar Yadav
Greenhorn

Joined: Aug 25, 2013
Posts: 23
it checks whether one computer is connected to another via LAN connection..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
So the input would be two IP addresses, and the output would be yes/no? It would be much easier if the input would be just the IP of one machine, and the other one would be the one where this software runs.
Sumit Kumar Yadav
Greenhorn

Joined: Aug 25, 2013
Posts: 23
yes sir, it would be like that only. please tell me how to start with that. what should i do first.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
Start by answering the questions Henry asked - how exactly do you define connectivity?
Sumit Kumar Yadav
Greenhorn

Joined: Aug 25, 2013
Posts: 23
sir, firstly i want to check the connectivity (whether a particular computer is connected via LAN or not)... it is basically like the ping command.. after checking the connection status i simply want to send packets of some defined size (or a file) to that computer and calculate the throughput on the basis of that.
So firstly i want to know how to check the connectivity (i am doing it using TCP).
And by connectivity i means whether the computer is present in that network or not.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19074
    
  40

Sumit Yaduvanshi wrote:sir, firstly i want to check the connectivity (whether a particular computer is connected via LAN or not)... it is basically like the ping command.. after checking the connection status i simply want to send packets of some defined size (or a file) to that computer and calculate the throughput on the basis of that.
So firstly i want to know how to check the connectivity (i am doing it using TCP).
And by connectivity i means whether the computer is present in that network or not.



If you want something like ping, then take a look at the isReachable() method of the InetAddress command.

Also note that "ping" is not exactly the same as whether "a particular computer is connected via LAN or not". If ping succeed, it does mean that the computer is connected, but it also mean that your computer is connected, the network routes are setup correctly, the ICMP service is up, and responded to the ping request in the time allotted.

So ... if ping fails, it does not mean that the other computer is not connected -- there is not enough information to make that conclusion.

Henry
Sumit Kumar Yadav
Greenhorn

Joined: Aug 25, 2013
Posts: 23
ok sir, i think isReachable() is what i am looking for...
what i would like to make is similar to the software "LAN speed test"... Also i want to know what are the different parameters on the basis of which i can test a LAN network. Thanks for the help. I uses ping because i saw it somewhere that to get the list of all IP addresses you need to ping all the computers connected within that network...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to build a LAN testing software using java network programming