0

I'm guessing this will be such a newbee question but I hit a wall and...

I am running the jWebSocket stand-alone server. For a client I am using Weberknecht And Eclipse is my IDE of choice.

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.

However, when I use the exact same code in my hello world Android app I get nothing :( I am also not seeing any console outputs even thought I used both Log.i and Log.v

Log.i(TAG, "YEI! connectToWS 1!");
Log.v(TAG, "YEI! connectToWS 1!");

Maybe I am calling the connect method in the wrong place?

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    connectToWS();
...

2 Answers 2

0

A bit more information would probably help. What are the contents of your connectToWS() method? Finding a connection issue is difficult without the code that does the connection.

1
  • I wanted to avoid pasting that code which is why I gave the link to it: code.google.com/p/weberknecht The entire content of that function is the first thing that is shown on his page. But, I already got a hint that maybe the problem is in trying to connect to LOCALHOST from the Android emulator. If my knowledge is adequate, the emulator is a VM and thus will look for the server on itself... But I would still expect and error in the Eclipse console OR at least my Log.v calls to work :( Jun 9, 2010 at 8:57
0

The problem was the localhost access. Once I changed it to 10.0.2.2 it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.