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.
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.
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)?
Using appbrain on my PC seems to work fine when I'm not logged in. When I do log in and try to click on an app I get this error message:
"Error: Server Error The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the query that caused it."
Anyone else have this issue when using Appbrain on their pc?
Well, It looks like I solved the problem. I just deleted my account and created it again and it's fixed (for now).
I am using HTC wildfire and using Rom galaxy nexus by Gmerv . the work good but the YouTube is not working prsoperly it shows errors mostly like "connection to the server is lost . please try again later " or " there was problem in playing in video please try again". also I am using WiFi have no data plan.
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.
I have a simple client-server app on android. the android service communicates with the server via tcp sockets. the service sends a simple String to server which works. the server processes the string and sends back an object to the android service. the object implements the serializable interface. the object "leaves" the server successfully but at the point where the android service receives the object (socket.readObject()
I'm working on an Android app that requires both client and server certificate authentication. I have an SSLClient class that I created that works beautifully on regular desktop Java SE 6. I've moved it into my Android project and I'm getting the following error: "KeyStore JKS implementation not found".I've looked online a bit and it looks like there's a possibility that Java Keystores are not supported on Android (awesome!) but I have a feeling there's more to it than that because none of the sample code I've found resembles what I'm trying to do at all. Everything I found talks about using an http client rather than raw SSL sockets. I need SSL sockets for this application.
I am doing a project where I have too develop an application that listens for incoming events by a service. The device that has to listen too events is an Android phone with Android SDK 1.5 on it. Currently the services that call events only implement communication trough UDP or TCP sockets. I can solve my problem by setting up a ServerSocket, but i doubt that's the most power efficient way. This application will be running most of the time, with Wi-Fi on, and I'd like too reach an long battery duration. I've been looking for options on the internet for my question for a while but i couldn't get a real answer.What is the most efficient way too listen to incoming events? Should I make an ServerSocket? or what are my options?Are there any other implementations that are more power efficient?
I noticed that if the Android phone is listening on a ServerSocket on the 3G network, and is then put to sleep with the power button, it no longer listens for incoming connections. The incoming TCP connection does not wake up the phone. Is this there a way to enable waking up a sleeping phone on incoming Server Socket connections, the way that incoming data on a regular Socket does?
I am trying to setup at ServerSocket on my Android phone, and send a char or int or anything from my computer. The code on the phone creates a ServerSocket and then blocks whilst waiting for a connection(plus some more bits if the socket is created. But I'm not getting this point, so left that out!)Basically, the phone is getting to accept, and the computer is not connecting. The xx.xx.xx.xx is the public IP of the phone I obtain programatically (and it matches up with checking on whatismyip.com).I have set the INTERNET permission on the phone. I have also been able to do this in reverse (ServerSocket on pc, client on phone).
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.
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?
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.
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?
I have recently written a socket server in PHP that will be handling communication between an Android phone application and my PHP webserver. Due to the fact that Android doesn't natively support push style notifications we are going to be using our webserver as the middleware layer to handle our 'pushes'. The socket server is stable, runs well, and seems to scale nicely. While I would eventually like to re-write this in C I don't have the skill necessary to do that right now so I am going to be staying in PHP for at least a short while. As of this moment our Android emulator is able to communicate through the server, get pushes, etc. so that part is all covered.
My concern is that, right now, anyone can open a socket to my server and will be given a client connection. While we won't be passing sensitive data back and forth I don't want to allow just anyone to connect over and receive broadcast information, eat up my resources, and clog my server in general. The question is, how do I secure a server like this? Let's assume that I am running on port 25,000--can I set up some sort of SSL layer on that port and expect devices like the Android to be able to communicate over that port without any special protocols or jumping through hoops? I have considered asking the connecting clients to authenticate their user against our user database before being given a client connection, but that would require the passing of credentials in plain text over the network which I am not about to do.
I am rather new to straight TCP communication from PHP and feel like I might just be missing something simple that allows for authentication on this level. Additional information: If I am able to get a valid username and password securely I would be using MySQL to validate the user and then accept/reject their connection based on the results of the query.
Hi, i am very new to programming in java however have a lot of experience in .NET (c# & vb.net). I am trying to create a new instance of a serversocket class in eclipse IDE and when i type the following code it is giving me an "Unhandled exception type IOException" and i havent even tried to run the code yet! I dont understand how my code is exceptioning before runtime or what i can do to fix it.
I want to make my phone communicate with computer with socket. I have try many kinds of source in internet. None of them works. The phone always display "HelloWorld <ActivityName>". Log.d() seems not work on my phone, because, I have used that, but nothing was printed.
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.
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?