On Wed, Aug 10, 2011 at 2:06 PM, NaveenShrivastva <
[email protected]> wrote:

> i have already assigned this permission...
>
>
> On Wed, Aug 10, 2011 at 1:23 PM, Gergely Juhász <[email protected]>wrote:
>
>> You mean that this line:
>> Socket socket = new Socket(serverAddr, SERVERPORT);
>>  throws an io exception?
>> Did you set INTERNET permission in your manifest file?
>> Maybe your pc's firewall blocks the connection.
>>
>>
>> On 10 August 2011 09:34, N K Shrivastva <[email protected]>wrote:
>>
>>> Hi i want tcp-socket connection for connection with socket and take
>>> response back:
>>>
>>>  public static String SERVERIP = "192.168.0.127";
>>>
>>>    // designate a port
>>>    public static final int SERVERPORT = 5675;
>>>
>>>  private void connectSocket() {
>>>        // TODO Auto-generated method stub
>>>        try {
>>>        InetAddress serverAddr = InetAddress.getByName(SERVERIP);//
>>> 10.66.3.44 is my pc' IP
>>>        Log.d("TCP", "C: Connecting...");
>>>        Socket socket = new Socket(serverAddr, SERVERPORT);
>>>        String message = "Hello from Client android emulator";
>>>        try {
>>>        Log.d("TCP", "C: Sending: '" + message + "'");
>>>        PrintWriter out = new PrintWriter( new BufferedWriter( new
>>> OutputStreamWriter(socket.getOutputStream())),true);
>>>
>>>        out.println(message);
>>>        Log.d("TCP", "C: Sent.");
>>>        Log.d("TCP", "C: Done.");
>>>
>>>        } catch(Exception e) {
>>>        Log.e("TCP", "S: Error", e);
>>>        } finally {
>>>        socket.close();
>>>        }
>>>
>>>
>>>        } catch (UnknownHostException e) {
>>>        // TODO Auto-generated catch block
>>>        Log.e("TCP", "C: UnknownHostException", e);
>>>        e.printStackTrace();
>>>        } catch (IOException e) {
>>>        // TODO Auto-generated catch block
>>>        Log.e("TCP", "C: IOException", e);
>>>        e.printStackTrace();
>>>        }
>>>    }
>>>
>>> Here my connection time out , how to check socket connection , what is
>>> wrong entry here  plz confirm me.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
>
>
>
What resign socket time out.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to