Android :: How To Connect G1 With Pc By Socket

Mar 3, 2009

I have a java server which run on the pc, and a client which run on the G1. Now, G1 is connected to the pc with a usb cable. I want to use socket to let them communicate with each other, as what I did in the emulator. But now G1 cannot find the server through the ip "10.0.2.2".InetAddress serverAddr = InetAddress.getByName ("10.0.2.2"); ClientSocket = new Socket(serverAddr,SERVERPORT); The ClientSocket is null. What's the IP of the pc now?

Android :: How to connect G1 with pc by socket


Android :: How To Connect Emulator To Socket Server?

Aug 6, 2010

So I have an android application that needs to connect to a socket server. That's simple enough if the socket server was running on my development machine. However the socket server is running on a server not only not on my own machine, but on a different subnet. How would I connect my emulator to the socket server? I understand how the port forwarding works to connect to the local machine, but I'm sort of confused on how I can redirect it across a subnet from my dev machine.

View 1 Replies View Related

Android :: How Host Machine Connect To Emulator Using Socket

Feb 2, 2009

How can my host machine connect to emulator using socket? In my application, I need emulator to open a server socket, then host machine connects to emulator as a client. But when host creates the socket using "10.0.2.15:xxxxx" (xxxxx is the port which emulator is listenning), it doesn't work. I think maybe the address"10.0.2.15" goes wrong. Is it a local address behind the "virtual router" and the host can't find? If so, how to find a correct IP address of emulator?

View 4 Replies View Related

Android : Socket - Network Connect Drops After 15 Minutes / Way To Fix?

Dec 14, 2009

I am able to connect to a Socket on my PC from my HTC 1 phone, via IP and successfully transfer data in a thread that gets rescheduled every few seconds. The problem is that after 15 minutes or so, the connection drops and my debug traces give me the "Network unreachable". A further clue is that if I plug in or replug in the USB cable I get reconnected.

I'm wondering what programmatic function will reconnect to the PC without having to fiddle with the USB cable. I've tried Wifimanger.reconnect and reassociate, neither did the trick. Perhaps if I knew what actions were peformmed when the usb cable is plugged in (which shouldn't have anything to do with my connection) I would be able to program them into my exception path.

View 7 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 :: 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 :: Socket Is Not Connected

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

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 :: Reading Data From Socket

Oct 31, 2009

I am facing some problem during reading data from socket If there is some null data in socket stream so the DataInputStream would not read the full data and the so at the receiving end there is exception for parsing data.What is the right way to read the data from socket so there is no loss of data at any time ?

View 3 Replies View Related

Android :: Activity Manager Vs Socket

Apr 7, 2010

I'm trying to catch socket errors (invalid ip, wrong port, etc.).It seems like the ActivityManager is shutting me down before I have time to catch these errors. I really have no idea what's going on here. My splash screen Haus attempts to start the service from a thread, however when the thread get's to the "about to create socket", it simply locks up. It locks up the entire app until the Force Close dialog box arrives.
I have Log.i all the way into the class that makes the connection.04-07 22:15:29.286: INFO/CONNECTION(19053): 4368 04-07 22:15:29.296: INFO/CONNECTION(19053): establishConnection() 04-07 22:15:29.446: INFO/CONNNECTION(19053): about to create socket 04-07 22:15:34.036: INFO/ActivityManager(76): Displayed activity com.scs.haus/.Haus: 8545 ms (total 8545 ms) 04-07 22:15:38.989: WARN/ActivityManager(76): Launch timeout has expired, giving up wake lock! I never see any of these Logs, except of course for the one that tells me I'm inside the method.

View 2 Replies View Related

Android :: Getting File Descriptor From Socket

Jul 23, 2010

The documentation for FileDescriptor says it is "The lowest-level representation of a file, device, or socket". I see that some classes like FileOutputStream and LocalSocket expose a getFD(), but Socket doesn't.How do you get at a true (INET) socket's fd? Alternatively, how do you get at the (private) SocketImpl member of Socket named "impl" (this one exposes the fd)

View 4 Replies View Related

Android :: Socket Timeout Not Working?

Jun 5, 2009

In the sample code, a SocketTimeoutException should be thrown if the connection can't be stablished in a second, isn't it? But the timeout take a looong time to be detected.

View 4 Replies View Related

Android :: How To Listen On Socket Port 80?

Jun 4, 2010

I'm new to Android development, now I'm working on a simple HTTP server project. I try to use ServerSocket to listen on port 80 but I failed. There will have an exception if I did this. I have already set INTERNET permission in manifest. I found that everything is Okay if I use port 8080, that's strange for me, why I cannot use port 80? I don't want my users to use another port to connect my server.

View 2 Replies View Related

Android :: Server Socket Error / How To Fix?

Jun 25, 2010

I'm now facing a very strange server socket problem, I have a server that will listen on a TCP port, I use the following code to do this work. public class RequestListenerThread extends Thread.

View 4 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 :: Server Socket Error

May 19, 2010

I am attempting to open a ServerSocket on my Android device to receive network connections, but do not seem to recieve network traffic from them. Running netstat -an on the device shows it is listening on 0.0.0.0:1234, but my connections to telnet to <public ip of Android device>:1234 do not appear (and do not receive a SYN,ACK in response). How can I write an application which will open an accessible server socket? Is this possible? I am thinking that either the ISP (mobile carrier) may be blocking this incoming connection attempts or the Android OS is blocking them (host firewall)?

View 4 Replies View Related

Android :: How To Send File By Socket?

May 5, 2009

I want to send a file from the Android phone to a server by socket.Could anyone give me some example code about how to do it?

View 2 Replies View Related

Android :: Proxy SDK 1.5 R1 - Socket Time Out

Aug 10, 2009

With this SDK version I can use my emulator using a proxy server. There is three solutions: - add values in system table - configure -http-proxy in eclipse run menu - configure APN on emulator to set the proxy. When I use Android browser, it's really slow but it's working. If I try to to a post from my application, I take an ANR and some minutes later a socket time out.

View 2 Replies View Related

Android :: Socket Not Disconnecting When Connectivity Changes

Jan 5, 2010

My chat application connects to a server and information is sent/received by the user. When the connection changes, such as 3g->wifi, wifi->3g, losing a data connection, etc, the socket sometimes stays connected for ages before disconnecting. During this time, it's impossible to tell if the connection is still active, it seems as if messages are being sent just fine. Other times, when sending a message, it will throw an IO error and disconnect.

Apart from implementing code to detect connection changes and reconnecting appropriately, is it possible to have the socket immediately throw an IO exception when connectivity changes?

I'm connecting using the following code:.........

I'm not using setSoTimeout as data may not be transferred for long periods of time depending on the remote server's configuration.

View 2 Replies View Related

Android :: Bad Socket Exception - SOCKS

Oct 14, 2010

I tried to connect to a server through a SOCKS server in an Android client app (Android OS 1.5 and 1.6) with below snippet code:

CODE:......

However it gave out an exception on the last line:

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

View 1 Replies View Related

Android :: Droid WIFI Socket Name?

Nov 10, 2010

I am developing one Android application which communicate with Wifi network. I want to know the name of the wifi socket in Android Device. i searched in google but nothing help me. I heard android device used RFCOMM socket for Bluetooth communication. Is RFCOMM socket used for Wifi communication?

View 1 Replies View Related

Android :: How To Perform Socket Communication

Jan 22, 2010

I have done socket communication in a single application it is working fine.

But my requirement is i have opened two emulators and i am able to send sms between those two.

Now i want to run server in one emulator(myavd-5554) and client on another emulator(myavd1-5556)

I have used the following code on Serverside public class TCPServerActivity extends Activity

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

View 2 Replies View Related

Android :: Send GPS Location Over Socket?

Mar 28, 2010

Could you please tell me how do I send the GPS location of the phone to a webserver through a socket. I am able to display the gps location on the screen with a toast widget in locationchanged() function. After that, I try to send the co-ordinates through a socket but the emulator crashes. tell me how to go about this.

View 5 Replies View Related

Android : Want To Block On A Socket For Data?

Jun 25, 2010

What is the efficient way of blocking on the socket for data after opening it.The method i used is to call read on input stream (this is a blocking call that waits till some data written to this socket).

//Socket creation
SocketForCommunication = new Socket();
InetSocketAddress sAddr = new InetSocketAddress("hostName", 8800);
SocketForCommunication.connect(sAddr,10000);
is = new DataInputStream(SocketForCommunication.getInputStream());
os = new DataOutputStream(SocketForCommunication.getOutputStream());

//Waiting on socket using read method for data
while(true)
{
int data = is.read();
if(data == HEADER_START)
{
processPackage(is);}}

Here problem is read can timeout.Is there a way to register a callback that gets called when data available to read on socket.?

View 2 Replies View Related







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