How to get the list of computer users in the network
//List of users in the network
import java.io.*;
public class NetworkUsers
{ static String all;
public static void main(String[] args)
{try { // Execute command Process child = Runtime.getRuntime().exec("net view"); // Get the input stream and read from it InputStream in = child.getInputStream(); int c; while ((c = in.read()) != -1) { char e=(char)c; System.out.println(e); //process((char)c); } in.close(); } catch (IOException e) { } }
private static void process(char c) { // TODO Auto-generated method stub System.out.print(c); //all =String.valueOf(c) +all; // System.out.println(all); }
}
Program explanation
Inputstream implies that the program is getting input as a stream of bytes
Java networking program to get client ip address in server.
Description : The client tries to establish a connection to server having ip address 127.0.0.1 through port 6363. The socket class is used to establish connection . The server always listen to port 6363 for request from the clients. Once a request reach the server through that port, it establish a connection with that particular client. Multiple clients can connect to server, since i used thread in server.
The program show a small demonstration of how Audio chat works in java. Click on the link to get the code. Two or more user can audio chat with the application. The program is developed using networking and java packages.
Please try audio chatting program... dont forget to post your feed back.
did you ever tried two way chatting using java code. Here we use socket communication, thread for this program. click the below link to download the code. javablzy