Question

How to listen for IP packets on a particular port?

Asked by: scurtis_1

Hi,

I need to write a simple application in Java, that listens for incoming data on a particular port and does something with it.  I know the data will be sent from a GPRS device, so the device will establish a connection and then send the data to the address and port my app will listen on.  I don't need to worry about the GPRS connection stuff. Just the data sent over the connection once it is established.  I assume the data will be wrapped up in packets of some sort so that it can be sent over the GPRS connection?

I don't know whether I need to do some sort of handshake with the GPRS device in order to accept its packets? Is there a free java app out there that can do this sort of thing? It is effectively IP traffic so I should imagine it is easily handled within Java's APIs?

Any code snippets to get me started would be really welcome!

Thanks
Scott

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-12-16 at 08:21:51ID20827245
Tags

java

Topic

Java Programming Language

Participating Experts
4
Points
500
Comments
4

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. What is the name for TCP connections that have not comple…
    What is the name for TCP connections that have not completed the three-way handshake ?
  2. Using Java to Make a GPRS Connection with a Wavecom Fa…
    Hi, I have a basic Java application that communicates with over a GPRS connection. Until now we have been using the Motorola v66e GPRS mobile phone connected to a USB port as our GPRS modem. This phone comes with a handy tool called GPRS Manager which is used to make the ini...
  3. Server/Client Broadcast/Handshake
    Hey, I was wondering if anyone could help me with the following. I need a server which will broadcast its ip address over the subnet it is located on. One or more Clients will be listening for the broadcasts, when received, the clients will reply to the broadcasts with their...
  4. GPRS / PC Communications
    Hi. I have a device that will transmit text data (engine temperature, oil pressure, etc.) via the GPRS network to a PC. My job is to recieve this data on the PC and show the information graphically. How would I actually access the GPRS network from this PC (which has a consta...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: markbrdslyPosted on 2003-12-16 at 08:42:18ID: 9950390

Hello Scott

I have to admit that I have never done anything like this but I would reccommend that you take a look at the dcoumentation for the ServerSocket class.

To quote what Sun say, "This class implements server sockets. A server socket waits for requests to come in over the network. It performs some operation based on that request, and then possibly returns a result to the requester."

I have taken a quick look myself and think - I emphasise think at this stage - that you will create an instance of the ServerSocket class and bind it to a specific port and there is a construtor provided to do just this. That instances accept method will then listen for a connection and will return an instance of the Socket class once that connection has been made. Once you have a socket, it is possible to open an InputStream on that object and possibly read the data that way.

For now, that is all the help I can offer.

Yours

Mark B

 

by: jimmackPosted on 2003-12-16 at 08:44:58ID: 9950416

Take a look at the socket information in the networking tutorial:

http://java.sun.com/docs/books/tutorial/networking/sockets/index.html

 

by: mjzalewskiPosted on 2003-12-16 at 09:38:30ID: 9950815

You need to know the 'port' on which the GPRS device will connect. That will be a number, possibly greater than 1000. Once you know that, the basic steps you would follow are like this:

1. Set up a ServerSocket object which listens at that port. Let's say the GPRS will connect to port 7000:

(import java.net.*;)
(import java.io.*;)

    ServerSocket srvGPRS = new ServerSocket( 7000);

2. Accept connections. Depending on your application, you might accept more than one connection at a time.

    Socket sckGPRS = srvGPRS.accept();

3. The Socket object represents a connection to a single device. Now get the Input Stream and Output Stream so you can talk. If your server can talk to several devices at once, you may want to do this in its own thread. But to answer your question, I will just go forward with a single conversation.

   InputStream isGPRS = sckGPRS.getInputStream();
   OutputStream osGPRS = sckGPRS.getOutputStream( );

4. If the GPRS speaks in bytes, you can read and write bytes directly to the input and output stream. However, if the protocol is text, you might find it more convenient to build a BufferedReader (to read strings from the device) and a PrintWriter (to send strings back to the device).

   BufferedReader brGPRS = new BufferedReader( new InputStreamReader( isGPRS));
   PrintWriter pwGPRS = new PrintWriter( osGPRS));

5. Assuming the protocol is based on Strings, you can now read from the device and write to the device like this:

  String sGPRSStatus = brGPRS.readLine();
  ... process the information. Maybe read more lines
  pwGPRS.println( "OK");

6. When the conversation is complete, you should close the streams and the socket:

   brGPRS.close();
   pwGPRS.close();
   sckGPRS.close();

7. At this point, you can listen for a new device by going back to step 2 -- caling ServerSocket.accept(). Or close the server socket and finish

  srvGPRS.close();

   

 

by: oraelbisPosted on 2003-12-16 at 12:31:13ID: 9951937

May be this example can help you:

package by.cis;

import java.io.*;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.*;
import java.net.Socket;
import java.net.UnknownHostException;

/**
 *  This is a test application which obtains clients information using
 *  Western Bridge to Briz corba server application protocol.
 *
 *@author     S. Berdachuk (Berdachuk@tut.by)
 *@created    Nov 2003 ã.
 *@version    0.1
 */
public class TstClient {

    /**
     *  This constructor manages the retrieval of the client information.
     *
     *@param  args  Description of the Parameter
     */
    public TstClient(String[] args) {
        if (contactServer()) {
            receiveResponse(args[0]);
        }
        quitServer();
    }


    // Timestamp of data.

    /**
     *  Start the application running, first checking the arguments, then
     *  instantiating a StockQuoteClient, and finally telling the instance to
     *  print out its data.
     *
     *@param  args  Arguments which should be <server> <stock ids>
     */
    public static void main(String[] args) {
        TstClient client = new TstClient(args);
        client.printResultInfo(System.out);
        System.exit(0);
    }


    /**
     *  Open the initial connection to the server.
     *
     *@return    The initial connection response.
     */
    protected boolean contactServer() {
        try {
            // Open a socket to the server.
            socket = new Socket(SERVER_NAME, SERVER_PORT);
            // Obtain I/O streams.
            dataReader = new DataInputStream(new BufferedInputStream(socket.getInputStream()));            
            dataOutput = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream()));
        } catch (UnknownHostException excpt) {
            System.err.println("Unknown host " + SERVER_NAME +
                    ": " + excpt);
        } catch (IOException excpt) {
            System.err.println("Failed I/O to " + SERVER_NAME +
                    ": " + excpt);
        }
        return ((socket != null) && (dataReader != null) && (dataOutput != null));
    }


    /**
     *  This method asks for all of the stock info.
     *
     *@param  inputInfo  Description of the Parameter
     */
    protected void receiveResponse(String inputInfo) {
        String response;
        // If the connection is still up.
        if (connectOK()) {
            //try {
            // Send query to server, calk packet length
            int len = inputInfo.length() + 2;
            int b1 = (int) len / 256;
            int b2 = (int) (len - len / 256);
            try {
                dataOutput.writeByte(b1);
                dataOutput.writeByte(b2);
                dataOutput.writeBytes(inputInfo);
                dataOutput.flush();

                //Read packet length
                b1 = dataReader.readByte();
                b2 = dataReader.readByte();
                int length = b1 * 256 + b2;
                byte[] dataPacket = new byte[length];
                //Read packet
                int count = dataReader.read(dataPacket, 0, length);
                if (count < 0) {
                    throw new IOException();
                }
            } catch (IOException e) {

            }
        }
    }


    /**
     *  This method disconnects from the server.
     *
     */
    protected void quitServer() {
        try {
            // If the connection is up, send a QUIT message
            if (connectOK()) {
                this.receiveResponse("0");
            }
            // Close the streams and the socket if the
            // references are not null.
            if (dataOutput != null) {
                dataOutput.close();
            }
            if (dataReader != null) {
                dataReader.close();
            }
            if (socket != null) {
                socket.close();
            }
        } catch (IOException ex) {
            System.err.println("Failed I/O to server " +
                    SERVER_NAME + ": " + ex);
        }
    }


    /**
     *  This method prints out a report on the various requested stocks.
     *
     *@param  sendOutput  Where to send output.
     */
    public void printResultInfo(PrintStream sendOutput) {
        // Provided that we actually received a HELLO message:
        if (returnedInfo != null) {
            sendOutput.print("INFORMATION ON REQUESTED"
                    + "\n\tCurrent As Of: " + returnedInfo + "\n\n");

        }
    }


    /**
     *  Conveniently determine if the socket and streams are not null.
     *
     *@return    true if the connection is OK.
     */
    protected boolean connectOK() {
        return (dataOutput != null && dataReader != null && socket != null);
    }


    final static int BUFFER_SIZE = 0x1000;
    final byte[] byteArray = new byte[BUFFER_SIZE];
    private Socket socket = null;
    private DataInputStream dataReader = null;
    private DataOutputStream dataOutput = null;

    private String returnedInfo = null;
    private final static int SERVER_PORT = 1717;
    private final static String SERVER_NAME = "10.0.0.215";
}// TstClient

/////////////////////////////////////////////////////////////////////////////////////////
package by.cis;

import by.cis.ClientHandler;

import by.cis.ServerConstants;

import java.io.*;
import java.io.IOException;

import java.net.ServerSocket;
import java.net.Socket;

/**
 *@author     S. Berdachuk (Berdachuk@tut.by)
 *@created    Nov 2003.
 *@version    0.1
 */
public final class Server {

    /**
     *  The constructor creates an instance of this class, loads the stock data,
     *  and then our server listens for incoming clients.
     *
     *@param  args  Description of the Parameter
     */
    public Server(String[] args) {
        init();
        //CheckParams(args);
        for (int i = 0; i < args.length; i++) {
            String s = args[i];
            char c1 = s.charAt(0);
            if (c1 != '-' && c1 != '/') {
                break;
            }
            if (s.length() > 1) {
                String s1 = s.substring(1);
                if (s1.startsWith("port=")) {
                    if (s1.length() > 5) {
                        String s2 = s1.substring(5);
                        serverProperties.setProperty(ServerConstants.KEY_PORT, s2);
                    } else {
                        break;
                    }
                }
            } else {
                break;
            }
        }
        try {
            // Create a listening socket.

            socket = new ServerSocket(
                    serverProperties.getIntegerProperty(ServerConstants.KEY_PORT, ServerConstants.DEFAULT_SERVER_PORT)
                    , serverProperties.getIntegerProperty(ServerConstants.KEY_MAX_CONNECTIONS, ServerConstants.DEFAULT_MAX_CONNECTIONS)
                    );

            print("Started. Listen port: "
                    + serverProperties.getIntegerProperty(ServerConstants.KEY_PORT, ServerConstants.DEFAULT_SERVER_PORT)
                    );
        } catch (IOException excpt) {
            errWriter.println("Unable to listen on port " +
                    serverProperties.getIntegerProperty(ServerConstants.KEY_PORT, ServerConstants.DEFAULT_SERVER_PORT) + ": " + excpt);
            System.exit(1);
        }
    }


    /**
     *  Retrieves a String identifying this Server object.
     *
     *@return    a String identifying this Server
     */
    public String getServerId() {
        return serverId;
    }


    /**
     *  Initializes this server, setting the accepted connection protocol. This
     *  method is only called from the constructor
     */
    private void init() {
        serverId = toString();
        serverId = serverId.substring(serverId.lastIndexOf('.') + 1);
        serverState = ServerConstants.SERVER_STATE_SHUTDOWN;
        serverProperties = getDefaultServerProperties();
        logWriter = new PrintWriter(System.out);
        errWriter = new PrintWriter(System.err);

    }


    /**
     *  Description of the Method
     *
     *@param  as  Description of the Parameter
     *@return     Description of the Return Value
     */
    protected static boolean CheckParams(String as[]) {
        try {
            for (int i = 0; i < as.length; i++) {
                String s = as[i];
                char c1 = s.charAt(0);
                if (c1 != '-' && c1 != '/') {
                    return false;
                }
                if (s.length() > 1) {
                    String s1 = s.substring(1);                    
                    if (s1.startsWith("port=")) {
                        if (s1.length() > 5) {
                            String s2 = s1.substring(5);
                            //serverProperties.setProperty(ServerConstants.KEY_PORT, s2);
                        } else {
                            return false;
                        }
                    }
                } else {
                    return false;
                }
            }
        } catch (Exception exception) {
            return false;
        }
        return true;
    }


    /**
     *  Prints the specified message, s, formatted to identify that the print
     *  operation is against this server instance.
     *
     *@param  msg  The message to print
     */
    final synchronized void print(String msg) {
        PrintWriter writer = logWriter;
        if (writer != null) {
            writer.println("[" + serverId + "]: " + msg);
            writer.flush();
        }
    }


    final void trace(String msg) {
        print("[" + Thread.currentThread() + "]: " + msg);
    }


    /**
     *  Sets the server state value.
     *
     *@param  state  the new value
     */
    protected final synchronized void setState(int state) {
        serverState = state;
    }


    /**
     *  Prints an error message to this Server object's errWriter. The message
     *  is formatted similarly to print(String), additionally identifying the
     *  current (calling) thread.
     *
     *@param  msg  the message to print
     */
    final synchronized void printError(String msg) {
        PrintWriter writer = errWriter;
        if (writer != null) {
            writer.print("[" + serverId + "]: ");
            writer.print("[" + Thread.currentThread() + "]: ");
            writer.println(msg);
            writer.flush();
        }
    }


    /**
     *  Description of the Method
     *
     *@exception  Throwable  Description of the Exception
     */
    protected void finalize() throws Throwable {
        //if (serverThread != null) {
        releaseServerSocket();
        //}
    }


    /**
     *  Description of the Method
     */
    private final void releaseServerSocket() {
        trace("releaseServerSocket() entered");
        if (socket != null) {
            trace("Releasing server socket: [" + socket + "]");
            setState(ServerConstants.SERVER_STATE_CLOSING);

            try {
                socket.close();
            } catch (IOException e) {
                printError("Exception closing server socket");
                printError("releaseServerSocket(): " + e);
            }

            socket = null;
        }
        trace("releaseServerSocket() exited");
    }


    /**
     *  Gets the defaultServerProperties attribute of the Server object
     *
     *@return    The defaultServerProperties value
     */
    private static final ServerProperties getDefaultServerProperties() {
        ServerProperties serverProperties;
        serverProperties = new ServerProperties();
        serverProperties.setProperty(ServerConstants.KEY_PORT, ServerConstants.DEFAULT_SERVER_PORT);
        serverProperties.setProperty(ServerConstants.KEY_MAX_CONNECTIONS, ServerConstants.DEFAULT_MAX_CONNECTIONS);
        return serverProperties;
    }


    /**
     *  Starts up the application.
     *
     *@param  args  Ignored command line arguments.
     */
    public static void main(String[] args) {
        Server server = new Server(args);
        server.serveClients();
    }



    /**
     *  This method waits to accept incoming client connections.
     */
    public void serveClients() {
        Socket clientSocket = null;

        try {
            while (keepRunning) {
                // Accept a new client.
                clientSocket = socket.accept();
                print("socket accepted");
                // Create a new client handler.
                ClientHandler newHandler = new ClientHandler(clientSocket);
                Thread newHandlerThread = new Thread(newHandler);
                newHandlerThread.start();                
            }
            socket.close();
        } catch (IOException excpt) {
            System.err.println("Failed I/O: " + excpt);
        }
    }


    /**
     *  This method allows the server to be stopped.
     */
    protected void stop() {
        if (keepRunning) {
            keepRunning = false;
        }
    }


    // A boolean used to keep the server looping until/ interrupted.
    private boolean keepRunning = true;

    private volatile int serverState;
    private ServerProperties serverProperties;
    private ServerSocket socket = null;

    private PrintWriter logWriter;
    private PrintWriter errWriter;
    /**
     *  Description of the Field
     */
    protected String serverId;
    private static int mode;

}// Server


///////////////////////////////////////////////////////////////////////////
package by.cis;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import java.net.Socket;

/**
 *  This class use used to manage a connection to a specific client.
 *
 *@author     S. Berdachuk
 *@created    Nov 2003.
 */
class ClientHandler implements Runnable {

    /**
     *  The constructor sets up the necessary instance variables.
     *
     *@param  newSocket  Socket to the incoming client.
     */
    public ClientHandler(Socket newSocket) {
        clientSocket = newSocket;
        clientInetAddress = newSocket.getInetAddress().getHostAddress();
        println("client connected");
    }


    /**
     *  This is the thread of execution which implements the communication.
     */
    public void run() {
        //String inputLine;
        String operationId;
        try {
            dataOutput =
                    new DataOutputStream(new BufferedOutputStream(clientSocket.getOutputStream()));
            dataReader =
                    new DataInputStream(new BufferedInputStream(clientSocket.getInputStream()));

            //Read client messages and respond
            while (true) {
                //Read packet length
                int b1 = dataReader.readByte();
                int b2 = dataReader.readByte();
                int length = b1 * 256 + b2 - 2;
                byte[] dataPacket = new byte[length];
                //Read packet
                int count = dataReader.read(dataPacket, 0, length);
                if (count < 0) {
                    throw new IOException();
                }
                //Quit
                if (dataPacket[0] == 48) {
                    break;
                }
                //Try make payment
                else if (dataPacket[0] == 49) {
                    String inputLine = new String(dataPacket, 0, count);
                    StringBuffer inf = new StringBuffer();
                    PaymentInfo paymentInfo = new PaymentInfo(inputLine);
                    println("received: " + inputLine);
                    int reslt = paymentInfo.getInfo(inf);
                    sendRespond((byte) reslt, inf.toString());

                    inf = null;
                }
                // Unknown command.
                else {
                    dataOutput.flush();
                    sendRespond((byte) 3, "ERROR. UNKNOWN COMMAND");
                }

            }

        } catch (IOException excpt) {
            println(" Failed I/O: " + excpt);
            // Finally close the streams and socket.
        } finally {
            try {
                if (dataOutput != null) {
                    dataOutput.close();
                }
                if (dataReader != null) {
                    dataReader.close();
                }
                if (clientSocket != null) {
                    clientSocket.close();
                }
                println("client disconnected");
            } catch (IOException excpt) {
                println(" Failed I/O: " + excpt);
            }
        }
    }


    /**
     *  Description of the Method
     *
     *@param  cmd              Description of the Parameter
     *@param  info             Description of the Parameter
     *@exception  IOException  Description of the Exception
     */
    private void sendRespond(byte cmd, String info) throws IOException {
        byte[] bArray = info.getBytes();
        int len = bArray.length + 3;
        byte b1 = (byte) (len / 256);
        byte b2 = (byte) (len - len / 256);
        dataOutput.writeByte(b1);
        dataOutput.writeByte(b2);
        dataOutput.writeByte(cmd);
        dataOutput.write(bArray);
        dataOutput.flush();
        println("Packet length: " + len);
        println("sended: " + b1 + " " + b2 + " " + cmd + " " + info);
    }


    /**
     *  Description of the Method
     *
     *@param  msg  Description of the Parameter
     */
    /*
     *  public void internalWait(int ms) {
     *  long t1 = new GregorianCalendar().getTimeInMillis();
     *  while ((new GregorianCalendar().getTimeInMillis() - t1) < ms) {
     *  }
     *  }
     */
    /**
     *  Description of the Method
     *
     *@param  msg  Description of the Parameter
     */
    final synchronized void println(String msg) {
        System.out.println(clientInetAddress + " " + msg);
    }


    private String clientInetAddress;
    private Socket clientSocket = null;
    private DataOutputStream dataOutput = null;
    private DataInputStream dataReader = null;
} // ClientHandler

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...