Android :: Unable To Create Server Socket In Eclipse (java)

Oct 20, 2010

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.

Android :: Unable to create Server Socket in eclipse (java)


Android :: Unable To Send Data Over TCP From Java Socket To .net Tcp Server

Nov 2, 2010

i am trying to get an android app to send tcp data to a server on my network. The server was written in c#. When i use the code below to transmit data, the server only receives a whole series of.

Socket socket = new Socket(host, port);
PrintWriter pw = new PrintWriter(socket.getOutputStream(), true);
pw.print("test");
socket.close();

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 :: After ADT 0.9 Update Eclipse Can Not Create R.java Automatically

Jan 21, 2009

I checked out cupcake branch yesterday and made the full build and sdk successfully, and I also built the ADT 0.9 with the command cupcake/development/tools/eclipse/scripts /build_ server.sh on another Linux box. Then I updated the ADT 0.9 and set new SDK on Eclipse. Then I created a simple Android project Test with Android Project Wizard, the Eclipse created project files except the R.java and then reported following errors. Seems the resources are not correctly parsed. Errors: [2009-01-21 15:07:32 - Test] W/ResourceType( 267): Unable to get buffer of resource asset file [2009-01-21 15:07:32 - Test]

View 15 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 :: 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 Server Socket Programming?

Mar 14, 2014

I have recently developed android application using server socket programming My problem is this its running show slow.

View 2 Replies View Related

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 :: Client-Server App / Bad Socket Exception

Mar 3, 2010

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()

View 1 Replies View Related

Android :: Server Certificates For Two Way Authentication SSL Socket

Oct 31, 2010

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.

View 1 Replies View Related

Android :: Can't Open Server Socket On Port 80 / How To Use

Jul 18, 2009

I was developing an app which need to open serversocket.

But, when i open one on poet 80, this throw a BindException :/ iven with the INTERNET permission. Open on other port work (ex: 8080).

Does this mean android not allow me to use this socket?

View 3 Replies View Related

Android :: Server Socket Programming In 1.5 / Most Power Efficient Way?

Dec 2, 2009

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?

View 1 Replies View Related

Android :: Server Socket To Wake Up A Sleeping Phone

Mar 17, 2010

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?

View 2 Replies View Related

Android :: Server Socket Accept() Not Accepting Connections

Oct 27, 2010

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).

View 2 Replies View Related

Android :: How To Use Http Connections Like TCP Socket In Java

Mar 9, 2010

may be asking a bit much here but I have faith in the community so it's worth trying. I'm making a game and I'm trying to pick the connection type to use for communicating between a Java mobile client and a Java server backend.Socket programing in Java is easy - there's a lovely tutorial on the subject and two way communication is trivial.Trouble is that on a mobile client (Android) it's not guaranteed that the cellular network will let you make TCP connections. That makes me think using an HTTP connection is the way to go. HTTP connections are request based but I need a way to push notifications from the server to the client. It seems the solution to this problem is to use 'long polling' I have read a bit about it but have yet to see a simple example for what I'm trying to achieve.Again I might be asking a lot but this seems like a fairly common problem, is there a library or framework I can import / use to wrap a Http connection and provide a two way long standing connection (That reconnects automatically etc). I read a bit about cometD but it doesn't seem to have a Java library that I can just pick up.The communication I need is not heavy, not constant two way streams of data just occasional updates either way to keep the game going.

View 4 Replies View Related

Android :: How To Approach Socket Programming Between C# -> Java

May 8, 2010

I've recently knocked up a server/client app for Windows & Android that allows one to send a file from Windows to an android phone over a socket connection. It works great for a single file but trying to send multiple files over in a single stream is causing me problems. I've also realised that aside from the binary data, I will need to send messages over the socket to indicate error states and other application messages. I have little experience with network programming and and wondering what is the best way forward.Basically the C# server side of the app just goes into a listening state and uses Socket.SendFile to transmit the file. On Android I use the standard Java Socket.getInputStream() to receive the file. That works great for a single file transfer, but how should I handle multiple files and error/messaging information? Do I need to use a different socket for each file? Should I be using a higher level framework to handle this or can I send everything over the single socket? Any other suggestions for frameworks or learning materials?

View 1 Replies View Related

Android :: PHP Socket Server (Push Notifications) - Security / Authentication

Aug 31, 2010

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.

View 4 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

Android : Make Socket Client - Server Source Code?

Apr 7, 2010

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.

View 3 Replies View Related

Android :: Java Socket IO Exception - Permission Denied

Nov 2, 2010

i am trying to connect to a server on my network running a tcp listener using the following java code. I am getting am IOException - Permission Denied. It is from an android 2.2 emulator.Does anyone know why?Socket socket = new Socket("1.1.1.1", 1111);PrintWriter out = new PrintWriter( socket.getOutputStream(), true);Out.println("test");socket.close();

View 2 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

Android :: Use HTTP Post Method Or Simple Java Socket Program

Mar 20, 2010

Could someone please suggest me a good/efficient way to communicate with the server. I could think of two options 1) Use http post methods to send data to a php script at the server which would later call the google api's written in another java program (jar)or use php to use google api's (if its possible) to find nearby restaurants and send the list back to client. 2) Use simple java socket programming. The server has a jar file that supports multi threading and it does the job of finding restaurants and sending the list.

View 4 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 : Thread Stopping In Synchronized Block / Create A New Socket?

Jan 9, 2010

I am facing a problem with a stopping thread which is in a synchronized block. I am using TCP socket. The problem is that I am waiting on a DataInputStream object and I want to create a new socket again but it doesn't allow me to do because of the synchronized block.

I have tried with Thread.interrupted(). I cannot avoid the synchronized block. Is there any other way to do the same?

dis = new DataInputStream(ReadWriteData.kkSocket.getInputStream());
int i = -1;
String aval = ""; //new String();
char c = (char)dis.read();

It is getting blocked on dis.read().

What I should do for escaping the dis.read when I want to create a new socket?

View 3 Replies View Related

Android :: How Can Android Know That Socket Is Disconnected By Server?

Jun 6, 2009

I wrote one application using socket, which connectes to one server. for some reasone, the server may Disconnect the connection, I noticed that once the connection is disconnected, android GC starts to work, and the emulator is freeze, after a while, my application got IOException, then GC stop to work, who know why?

View 2 Replies View Related

Two Android Clients And One Java Server?

Mar 5, 2013

I've created a java server and an android client (A), the client(A) gets it's GPS coordinates and sends them to the server, I need the server to send them to client(B). I'm not entirely sure as to what to do, whether I should have separate ports etc or what.

Below is my two clients and server

SERVER

[HIGH]import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

[code].....

With this, I run the server, then run CLIENT B in the emulator and CLIENT A on the device, once I run CLIENT A, CLIENT B force shuts.

CLIENT A / SERVER connectivity is 100%, it prints to console (for testing). What I need to try to find out is how do I send the data to CLIENT B, I have used different ports and i'm sure that's why CLIENT B force shuts.

View 1 Replies View Related

Android :: System Server Debugging Using Eclipse

Sep 15, 2010

how can i debug the android telephony and radio service part of android (system_server) using eclipse debugging tool.

View 3 Replies View Related







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