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
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
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
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
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
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
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.
View 3 Replies
View Related
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Jun 23, 2013
Some days ago I created a thread asking about random freezes/restarts.Well, Google Play is now freezing every time I try to check for an app, I've also realized the cache thingy only works for a while, I went on a trip, now that Im back the tablet freezes again and all.Should I just cache wipe everytime this happens, or just once? Is it safe to cache wipe really often?
View 1 Replies
View Related
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
Oct 14, 2009
I'm using ThreadSafeClientConnManager to manage a pool of client connections, because my application has several threads, which are simultaneously connecting to a webserver.
Abstract sample code:
CODE:..............
Now lets say on of this threads is downloading a large file, but then the user of my application is switching to another activity/screen. Therefor the file is needless and I'd like to abort this download connection.
In ThreadSafeClientConnManager I found this method: public ClientConnectionRequest requestConnection (HttpRoute route, Object state) Returns a new ClientConnectionRequest, from which a ManagedClientConnection can be obtained or the request can be aborted.
So far I've been using:
CODE:.........
Now from what I understand, I've to use:
httpclient.getConnectionManager().requestConnection(HttpRoute route, Object state);
And that's the point where I'm stuck. I assume that for the route I can just use new HttpRoute(new HttpHost("10.0.0.1")) or whatever my server is, but what to put in for Object state?
And second, as soon as I've the ClientConnectionManager I can call getConnection(long timeout, TimeUnit tunit). But then from there, how I do I execute my HttpGet httpRequest = new HttpGet(URL_TO_FILE); as I did before with HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);?
I've been gone through the documentation and tried out quite a few different things, but I wasn't able to obtain a working solution. Therefor any suggestions and/or code examples are more than welcome.
View 1 Replies
View Related
May 12, 2010
Whenever a application needs internet and connection fails, I get a message dialog
Connection failed
This application requires network access. Enable mobile network or Wi-Fi to download data.
and two buttons, Settings, Cancel.
How do I detect there is no internet connection?
How do I popup a same dialog in my application?
View 3 Replies
View Related
Oct 27, 2010
I'm coding a very basic FTP client on top of my application and I have 2 activities. The first one is the file explorer and the second one is the image viewer. Once I click on the image filename on the explorer, I want to pass the connection to the other activity to handle extra stuff. Basically, I want to keep the same org.apache.commons.net.ftp.FTPClient object (which handles the connection) alive in-between the 2 activities. I know I can't pass an object inside an intent so I don't know what my best bets are.
View 1 Replies
View Related
Jul 23, 2010
What's the technical term for being able to have voice connection and data connection simultaneously? Like AT&T was promoting heavily for a while.Apparently, the new T-Mobile Vibrant has this capability. A friend got one and was accessing the web while talking to me, double jealous now.I have benn lusting after the Verizon version, Fascinate, and wondering if there is any chance it will as well.
View 2 Replies
View Related
Feb 17, 2010
I am trying to use httpclient to hit a http link. For some reason I keep on geting this "socket is not connected" error. I am not sure about the reason for this error. Can any one help? This error also occurs when I start using the car navigation app or whenever I try to forward calls.
View 5 Replies
View Related