Doubts regarding receiving port based SMS using Socket conne

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Doubts regarding receiving port based SMS using Socket conne

Postby rakesh86shankar » Thu May 16, 2013 1:31 pm

I am trying to receive port based SMS with the below piece of code.

Code: Select all
serverSocket = new ServerSocket(SERVERPORT);
     Socket client = serverSocket.accept();
     try {
            BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
            line = null;
            while ((line = in.readLine()) != null) {
                Log.d("ServerActivity", line);
                System.out.println("Reading Line is>>>>>>>>>>>>>"+line);
        } catch (Exception e) {
            System.out.println("Exception While Reading SMS>>>>>>>>>>"+e);                 

It waits in the line of serverSocket.accept();

I am not able to receive the message.

I am not able to test fully,I am not having option of testing it here,sending the port message.

In Manifest file,I added following Persmissions too,
<uses-permission android:name="android.permission.READ_SMS"></uses-permission>
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"></uses-permission>

But Still not able to receive message,Am I missing anything which as a result ,am i not able to receive the message in required port number.

Did any one faced this similar sort of issue?

Posts: 38
Joined: Fri May 29, 2009 9:51 am


Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 3 guests