Android :: Detecting Socket Connection Failure

Apr 1, 2010

I am working on an app that uses a Socket to connect to a controller over TCP. The protocol library was written in Java and I am implementing it in android via a Service. where the Connection class is a Thread that handles the communications with the controller. It's where the Socket lives.I'm using the Preferences mechanism to store the IP and Port. If I feed the Socket the correct IP and Port, the Connection Service works beautifully. However, I am trying to simulate a user entering the wrong information and having the connection fail. The ultimate goal is to present a dialog and offer the ability to "reconnect" or "update settings". However, when I enter a wrong Port number, the application simply hangs.I was under the impression that Threads executed concurrently so I've tried moving the call to start the Connection Service to a Thread, but it still hangs the application.

Android :: Detecting Socket connection failure


Android : Socket Creation Failure

Feb 3, 2010

I created a simple client socket from my Activity, but it fails. I am running this activity in emulator and server runs on PC(its a different application without Android stuff).

*clientSock = new Socket("127.0.0.1", 30001);*

logcat shows java.net.SocketException: permission denied <maybe missing INTERNET permission>

If I enable permission for my Activity(android.permission.INTERNET), my Activity constructor itself not called and logcat shows following info. Permission Denial: starting Intent < flg=0x10000000 cmp=com.example.client/.MyClientActivity > from null <pid=-1, uid=-1> requires android.permission.INTERNET.

Any suggestion on how to resolve this issue?

View 3 Replies View Related

Android :: Detecting And Changing Programmatically Data Connection

Jun 14, 2010

I know that unfortunately detecting and changing programmatically data connection (GPRS/UMTS) on vanilla Android is not possible, and the common workaround is to edit APN settings. This is hardly a nice solution. However on my device (Xperia X10) I have an additional setting near "data roaming", that allows to enable or disable MMS and data. I suppose that this is a personalization made by Sony Ericsson, and maybe even other vendors have something like this. Is there a way to access this setting?

View 3 Replies View Related

Android :: Socket Freezes Using GSM Connection

May 27, 2010

I'm working on application that uses a socket connection.I've implemented 2 different Threads for the read() and the write() methods so they are not being blocked by the read.Everything is working well on the WiFi connection but when I switch to GSM connection the connection becomes unstable without any exception being thrown. It means that there are freezes.the write and read seems to work but no data is actually being piped.

View 10 Replies View Related

Android :: Socket Refused Connection

Dec 7, 2009

I wondered if there could be a specific reason why a server socket could refused a client request connection , the server running on one android device the other on the emulator?

View 2 Replies View Related

Android :: How To Manage Connection To A Socket?

Jun 21, 2010

I would like to know what is the recommendation for socket connection management in Android?In our App we would like to be connected to a TCP/IP server when our app is in the foreground or paused. So, create a connection to a TCP/ IP server when the App starts basically, On Create of the launcher activity. However, we do not want to create a new connection and close connection every time an activity is created, paused, destroyed or orientation changed. So, we save the connection object in the App class and the activities will reuse the same connection.Question is when do I close it? I would like to close the socket when the App is "paused", "stopped" or "destroyed". The problem is these messages are not sent in the App context. How can I figure out if the App is in foreground or not? Even the "Terminated" event for an App is not guaranteed to be delivered. So, in that case how do I know when to disconnect?

View 2 Replies View Related

Android :: Socket Freezes Via GSM Connection

May 24, 2010

I'm working on application that uses a socket connection. I've implemented 2 different Threads for the read() and the write() methods so they are not being blocked by the read. Everything is working well on the WiFi connection but when I switch to GSM connection the connection becomes unstable without any exception being thrown. It means that there are freezes at the write and read seems to work but no data is actually being piped.

View 2 Replies View Related

Android :: Bluetooth Socket Connection

Nov 11, 2010

I'm creating an application that uses an android to send and receive data via bluetooth. but I'm having problems when creating the socket. He gets caught in that line mmSocket btserver.accept = (); And I can not pair with any device.I have another doubt, I can make that communication with an android and a symbian?

View 1 Replies View Related

Android :: Server Socket 3G Connection

Mar 3, 2010

I have been trying to setup a Droid to Droid 3G connection. I can confirm that all works great in wifi mode. The Droid can make connection requests (Http, Telnet, raw sockets) in 3G, but I cannot get the Droid to accept a socket connection in 3G mode. I was told by Verizon that a special license may be needed to accept socket connection requests and they would send me some information. So far none has been received. If anyone knows how to program the Droid to accept socket connection requests over 3G, please respond. Also if anyone knows why this not allowed please respond.

View 10 Replies View Related

Android :: Permanent Socket Connection Drains Battery

Jul 15, 2010

I am developing an app which has one service running in the background even if the application is closed. This service basically listens to the server via socket connection. It is an app's requirement to keep one consistent connection open. but this drains battery liek anything. I know socket is costly affair in the sense of battery life. Do anybody know any other way to keep communication channel open? or any optimization in using socket?

View 9 Replies View Related

Android :: Create Persistent Socket Connection On Droid?

Apr 29, 2010

First off, let me say that feel free to recommend me if long lived TCP persistent connections are the way to go or persistent HTTP connections are better.

I've also pre-read that instead of having a persistent connection, I can have a polling mechanism.

I'm just asking in the curious interest of how can I create a persistent connection from Android to a server?

View 2 Replies View Related

Android :: SSL Socket Blocks On Read While Changing Connection / Is It A Bug?

Feb 19, 2010

I assume that when I do a read on the inputstream, it blocks until it gets more data to read.
I also assume that when the connection is closed, the read throws an IOException.

The problem is that sometimes when I change the connection from carrier to WiFi or from WiFi to carrier, the read just gets stuck and never throws the IOException.

The SDK is 1.5 and the phone a HTC Hero.

This behavior is quite ugly for me because I need to stay always connected.
Does someone else have ever seen this problem ? Is it a bug or am I the bug?

View 2 Replies View Related

General :: Socket Connection App SDK?

Jun 20, 2012

I'm making a chat program and server relay on pc and I was wondering if there's a simple template for tcp/ip socket connections.

View 9 Replies View Related

Android :: Server Socket Ports Connection Timeout Error

Jul 9, 2010

I am playing around a bit with peer-to-peer communication with android devices.I have written a basic program that creates a listening ServerSocket on each phone using the application. Using the application you can also connect to other devices that is listening, by connecting to the remote ServerSocket. Nothing strange about that.My problem is that it seems that the listening port is not open for connection on different devices. I can connect to my HTC Desire, works like a charm. But connecting to a HTC Hero I get timeout, same if I try to connect to the emulator. But connection FROM the emulator to the Desire and FROM the Hero to the Desire works like a charm. Whats up with this? No security apps is installed and both devices(and the emulator) is running 2.1.

View 1 Replies View Related

HTC EVO 4G :: Message Pop Up - Data Connection Failure

Jul 7, 2010

I keep getting this message pop up all day. I will get 9/10 of a page to load and then the message pops up. I couldn't log on all day to the forum.

View 7 Replies View Related

Android :: Make Beep Sound Notification On Socket Connection Establishment?

Aug 3, 2010

How can I make the Device sound a beep when socket connection has been established. In other words, how to set a notification tone when an event occurs in Android sdk?

View 1 Replies View Related

Socket Programming - TCP Connection Through NetBios (NBNS) Name?

Dec 22, 2011

I'd like to know whether there is a way to connect to a TCP server (socket server) in an computer using his name (e.g.: my computer has a host name: MyComputer; then I must connect with it using his name).

It can be done using NBNS protocol (NetBios Name Service), but always I try to connect using his name, the Tablet uses DNS protocol instead of NBNS, as I might expct.

View 1 Replies View Related

Android :: Connection Between Server/socket When It Moves From EDGE To WIFI And Vice Versa

Dec 16, 2009

Does Android keep the connection between the server/socket when it moves from EDGE to WIFI and vice versa?

View 1 Replies View Related

HTC Droid Eris :: 3G Mobile - Data Connection Failure

May 5, 2010

I purchased an Incredible, which I was not too happy with, so I decided to send it back and reactivate my Eris. My Eris was at 2.1v2 at the time. I called Verizon and had them do the switch through their customer service number.

Immediately I began to notice that I had a lack of 3G. My Turn Mobile On setting would be stuck on "Turning On". I could force it by switching airplane on and off and then using the power button to choose Mobile settings. Once I'd get it on, 3G would be spotty and drop in and out, and when I do have it it is ridiculously slow. Speed test shows downloads of 302 kbps and uploads of 1023 so it appears I have upload 3G but not download. Many times throughout the day I get data connection failures on apps requiring internet.

So, I called Verizon, we went through all their steps including escalation to tech support and they decide it is my Eris (which worked perfectly previously). They are sending me a replacement. In the interim, I went back to the Incredible. And immediately had the exact same problem on the Incredible. I called Verizon, and went through all their steps, and now they want to send me a new Incredible. I went back to the Eris, and upgraded to 2.1v3, still the same problem. I am 100% confident that when I get the replacement Eris it will solve nothing. APNs are at correct default.

View 3 Replies View Related

Socket Networking - Set Up Basic Network Connection Using Droids?

Feb 7, 2012

I'm trying to set up a basic network connection using droids but I'm having problems.my server program:

Code:
ServerSocket ss = new ServerSocket(8888);
while(!end){
//Server is waiting for client here, if needed[code]....

the server runs until it reaches ss.accept() like it should but the client still can't connect. The client usually times out and nothing happens

I'm running both these programs using eclipse on my computer. I set the premissions in the manifest for both programs to let them use the internet and I have the port forwarding .

View 2 Replies View Related

Communicate To WiFi Enabled Arduino Board With Static IP - Socket Connection

Feb 3, 2012

So Im writing an application to communicate to a Wi-Fi enabled Arduino board with a static IP...

This is what Im trying to do...
1.) Enter Ip and Host
2.) Connect
3.) Simply send either a "0" or "1" to the arduino board

There are two activities at the moment, one to enter the IP and port of the Board (which is set from the board itself) and one to send data to the board. When i comment out the connection methods in the Communicator class the app swithches activities without any issues, but when i un-comment them and attempt to connect, the app immediately closes after i attempt to connect.

Code:

package car.test.namespace;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

[Code]...

Code:

package car.test.namespace;
import java.io.*;
import java.net.*;
public class Communication {

[Code]...

Code:

package car.test.namespace;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

[Code]..

Also, im not even seeing the "Connection Failed" message, the app is just shutting down,.

View 4 Replies View Related

Android :: Android Socket Connection Refused

Mar 11, 2010

I am trying to open a Socket on Android but everytime I try I keep getting connection refused error no matter what way I try.The error happens on the following line of code where I try to create the connection.

View 2 Replies View Related

Android :: Android Device To PC's Socket Connection

Oct 7, 2010

I am facing problem to establish a socket connection from android device to PC's a specific port like 8080. I just want to create a socket which will connect to the specific port and also write some data stream on that port.I have written some code for this purpose.

View 3 Replies View Related

Android :: Java Socket Not Throwing Exceptions On Dead Socket?

Jun 29, 2010

We have a simple client server architecture between our mobile device and our server both written in Java. An extremely simple ServerSocket and Socket implementation. However one problem is that when the client terminates abruptly (without closing the socket properly) the server does not know that it is disconnected. Furthermore, the server can continue to write to this socket without getting any exceptions. Why? According to documentation Java sockets should throw exceptions if you try to write to a socket that is not reachable on the other end!

View 5 Replies View Related

Android :: Socket Programming - Java - Many Clients One Socket

Nov 12, 2009

Essentially Im trying to get many many java clients connect to a socket on my ColdFusion server (Using the Socket Gateway). However before i even start to code this, Im a little confused about sockets and their performance. First of all, are sockets meant for many(1000+) clients connecting to one socket (say port 2202) on one server? How is the performance if all there waiting for is basically a ping, or something such that when these clients receive this "ping" they can go get some new data.

View 5 Replies View Related

Android :: Android Socket Connection

Jun 8, 2010

I'm guessing this will be such a newbee question but I hit a wall and I am running the WebSocket.Now, when I start the server and run the Weberknecht client like a normal Java application I get a connection. Granted, the connection is quickly dropped because the handshake needs to be configured but at least the server shows me a connection was attempted.

View 2 Replies View Related

Android :: Connecting Android Bluetooth Client Socket To Ubuntu Server Socket

Jul 15, 2010

I am writing an Android app that should exchange data to a server over Bluetooth, with the server side on a PC running Ubuntu, using the bluez library, in C (or C++).

My Android app fails (IOException) when I try to connect to my server socket on the PC.

Here is essentially what I in the java code (in Android, full eclipse project here: http://dl.dropbox.com/u/2968234/ThinBTClient.zip)

CODE:...........

This throws IOException after a timeout of 10seconds or so.

On the server side (in Ubuntu 8.10), I basically set up a Bluetooth server socket, along the lines described in the example bluez/sdp-register.c

Down below is my C++ program. To compile it do

g++ -I/usr/include/glib-2.0/ -I/usr/lib/glib-2.0/include -o bt_server bt_server.cpp -lbluetooth

I can do the reverse succesfully, i.e. create a server socket in Android and connect from Linux, however this is not what I want to do!

I think either the problem has to do with my config of Ubuntu.

CODE:................

View 1 Replies View Related

Android :: Socket Exception Socket Not Connected Android

Oct 27, 2010

In my android application i am trying to run a application using GPRS connection and not WIFI.When tried to run in wifi the app runs fine.The browser works fine with the APN settings set but when trying to connect to server using my application it gives me socket exception.I am using the below permissions in manifest file.
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses- permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name= "android.permission.CHANGE_NETWORK_STATE"></uses-permission>
<uses-permission android:name= "android.permission.WRITE_APN_SETTINGS" ></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" ></uses-permission>
I am receiving Socket not connected exception.Is there any other permission which i need to add for using GPRS connection other than WIFI.
10-27 18:26:19.689: WARN/CalSyncSvc(166): com.motorola.blur.service.email.protocol.activesync.ASException: Problem executing HTTP POST

10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendRequest(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendXMLCommandNoProvisoning(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendXMLCommand0(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendXMLCommand(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.service.email.protocol.activesync.ActiveSyncMgr.sendFolderSyncCommand(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.service.email.protocol.activesync.ProviderAPI.sendFolderSync(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.service.email.protocol.activesync.ProviderAPI.updateMapFromFolderSync(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.service.email.protocol.activesync.ProviderAPI.updateFromFolderSync(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.calendar.sync.activesync.SyncService.syncAccount(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.calendar.sync.activesync.SyncService$QueueEntry.run(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:416)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:256)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at java.util.concurrent.FutureTask.run(FutureTask.java:122)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:648)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:673)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at java.lang.Thread.run(Thread.java:1058)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(Unknown Source)
10-27 18:26:19.689: WARN/CalSyncSvc(166): Caused by: java.net.SocketTimeoutException: Socket is not connected
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocketImpl(Native Method)


10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocket(OSNetworkSystem.java:140)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:229)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:521)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at java.net.Socket.connect(Socket.java:1019)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:317)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:129)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
10-27 18:26:19.689: WARN/CalSyncSvc(166): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
10-27 18:26:19.689: WARN/CalSyncSvc(166): ... 17 more

View 2 Replies View Related

Android :: Detecting Where Has Been Touched

Jul 7, 2010

I have a single bitmap with several individual pictures in (each one is an option) and I would like to detect when the user touches these pictures. I am using the event.getX and event.getY to detect where is pressed, I know the top left X Y and bottom right location of each of the pictures. What is the best way of detecting which one is pressed? (i.e. tieing up the event press and which picture has been pressed?

View 2 Replies View Related

Android :: Detecting Hardware Capabilities

Jun 3, 2009

There are return values and such that allow handling if SensorManager sensors and location providers aren't available, but what about the camera and microphone for audio recording? Is there a way to detect those in software, or are we just to assume that every device running Android (even the rumored set-top box) is going to have a camera and microphone and try to use them?

In the case of the camera, it would seem that Camera.open() returning null would indicate the lack of hardware. I don't know if that assumption is valid or not, though, considering it isn't documented as such.

In the case of the microphone, though, I don't see anything that could possibly be checked. The same goes for the camera if you're wanting to do video with the MediaRecorder class.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved