How to receive gprs/gps data at server side

communication , gprs , gps , tcp Singapore, Singapore
  • 11 years ago

    Hi, I have a device that records gps locations and sends them to an ip/port pair via gprs. I wrote a simple tcp server at my server, but I couldn't receive any data from that device. I posted the tcp server code below. Any suggestions are appreciated. //TCPServer.java

    import java.io.; import java.net.;

    class TCPServer { public static void main(String argv[]) throws Exception { String fromclient; String toclient;

         ServerSocket Server = new ServerSocket (5000);
    
         System.out.println ("TCPServer Waiting for client on port 5000");
    
         while(true) 
         {
            Socket connected = Server.accept();
            System.out.println( " THE CLIENT"+" "+
            connected.getInetAddress() +":"+connected.getPort()+" IS CONNECTED ");
    
            BufferedReader inFromClient =
               new BufferedReader(new InputStreamReader (connected.getInputStream()));
    
            while ( true )
            {
                fromclient = inFromClient.readLine();
    
                if ( fromclient.equals("q") || fromclient.equals("Q") )
                {
                    connected.close();
                    break;
                }
    
    	        else
    	        {
    	         System.out.println( "RECIEVED:" + fromclient );
    	        } 
    
    		}  
    
          }
      }
    

    }

  • 10 years ago

    hi!

    I have the same problem. my code is based on java socket server receives data from hyperteminal but does not receive the gps data sent over gprs!

    I know the pc receives them because I installed a sniffer and see the receipt of information.

    I did several searches and can not find this solution

    I am very grateful if someone could help

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone” - Bjarne Stroustrup