Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to receive gprs/gps data at server side

Status
Not open for further replies.

hixiaohui

Newbie level 1
Newbie level 1
Joined
Jan 30, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Singapore
Activity points
1,292
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
//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 );
}

}

}
}
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top