×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    11

    Java TCP server, Symbian Client connection problem

    I'm using localhost TCP/IP for IPC between a java application and a symbian application.

    My problem is basically that I have to start the java server FIRST, then the symbian client otherwise the server will not receive any messages. I can then quit the symbian client and start it again and it will still work.

    The symbian application will not try to connect until I tell it to, so i have not found any reason for this behaviour. I have even tried to move the Connect() to socketServ from the constructor to the actual call of the sending function with no luck.

    Is there anyone that has come across this problem? I can elaborate further on what i'm doing in both programs, but I just thought I would write a quick note and see if anyone has seen this problem before.

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    47

    Re: Java TCP server, Symbian Client connection problem

    Hi,
    Can you elaborate your problem?
    Do you mean you have to start Server first and then client otherwise client can't communicate with server?

  3. #3
    Registered User
    Join Date
    Sep 2007
    Posts
    11

    Re: Java TCP server, Symbian Client connection problem

    Quote Originally Posted by yddusane View Post
    Hi,
    Can you elaborate your problem?
    Do you mean you have to start Server first and then client otherwise client can't communicate with server?
    OK, i will try to explain a bit better. This is what I have:

    A Java program, named FOO, containing a TCP server which will bind to a certain port. The server will not start until told so.

    A Symbian program, named BAR, containing a TCP client which will try to connect to this port upon user interaction.

    To get it to work it is enough if I start the program FOO, I don't actually have to start the server. So this will work:

    1) Start FOO
    2) Start BAR
    3) Start Server in FOO
    4) Tell BAR to send request, get response
    5) Repeat 4 until battery runs out

    2 and 3 are interchangeable.

    But this won't work:

    1) Start BAR
    2) Start FOO
    3) Start server in FOO
    4) Tell BAR to send request, NO response
    5) Battery will probably run out before i get a response

    This really bugs me as it is neccesary to start BAR first.

    I have also written a symbian server application that basically does the same as the Java one, and with that i don't ecounter this problem.

  4. #4
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: Java TCP server, Symbian Client connection problem

    Well, of course you need to have the server running and listening for incoming connections, otherwise where do you want the client to connect to?

    If I understand correctly, your "java app" is actually a j2me midlet? In such case, have you considered using the push registry? (also assuming midp2)

  5. #5
    Registered User
    Join Date
    Sep 2007
    Posts
    11

    Re: Java TCP server, Symbian Client connection problem

    Quote Originally Posted by PushL View Post
    Well, of course you need to have the server running and listening for incoming connections, otherwise where do you want the client to connect to?

    If I understand correctly, your "java app" is actually a j2me midlet? In such case, have you considered using the push registry? (also assuming midp2)
    Yes, it is a j2me. I will probably use the push registry to force the server to start, but I haven't tried this yet.

    Of course the server has to be listening before anyone can connect to it! That's not the problem here...

    I have a symbian daemon that lies in the background and listens for keypresses. When a certain key has been pressed it will try to connect to a certain TCP/IP port on localhost.

    Now, i should be able to start this daemon before the server is started right? It will not do anything connection-wise until I tell it to.

    Consider this: If a web server goes down you don't have to restart your web browser to access it when it's up again. Agree on that?

  6. #6
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: Java TCP server, Symbian Client connection problem

    Quote Originally Posted by ufepuf View Post
    I have a symbian daemon that lies in the background and listens for keypresses. When a certain key has been pressed it will try to connect to a certain TCP/IP port on localhost.

    Now, i should be able to start this daemon before the server is started right? It will not do anything connection-wise until I tell it to.
    Why not start the server too, and make it listen silently for any incoming connections?

    Consider this: If a web server goes down you don't have to restart your web browser to access it when it's up again. Agree on that?
    Agree, but I can't see what point are you trying to make.

  7. #7
    Registered User
    Join Date
    Sep 2007
    Posts
    11

    Re: Java TCP server, Symbian Client connection problem

    Quote Originally Posted by PushL View Post
    Why not start the server too, and make it listen silently for any incoming connections?



    Agree, but I can't see what point are you trying to make.
    Alright, what I want to do is this:

    1) Autostart daemon when phone starts
    2) The daemon will start the server with push register
    3) Daemon sends notifications to j2me server

    But I haven't tried push registry yet and are doing this:

    1) Autostart daemon when phone starts
    2) Manually start j2me server
    3) Daemon has to be restarted to be able to talk to the server

    The difference is how j2me is started. It should not affect the communication when it is running, right? Maybe I will just try with push registry and see if it works then, but I see no reason why my current setup is not working!!

    This is what I want to accomplish:

    It should be possible to start the client first, and when the server is started the client should be able to connect to it.

  8. #8
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: Java TCP server, Symbian Client connection problem

    Quote Originally Posted by ufepuf View Post
    It should be possible to start the client first, and when the server is started the client should be able to connect to it.
    Of course it should, as long as the client doesn't try to connect before the server starts listening. This means both apps should be synchronized (ie. client starts server, server starts listening, then client makes request)

  9. #9
    Registered User
    Join Date
    Sep 2007
    Posts
    11

    Re: Java TCP server, Symbian Client connection problem

    Quote Originally Posted by PushL View Post
    Of course it should, as long as the client doesn't try to connect before the server starts listening. This means both apps should be synchronized (ie. client starts server, server starts listening, then client makes request)
    Yes, of course. This is exactly what i'm trying to do.

    But what i've been trying to say with my last posts is that this doesn't work! And that it is indeed working with symbian client and symbian server, but not with symbian client and java midlet server.

    It seems that you are missing my point here? I'm not trying to connect to a server that has not started.

  10. #10
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: Java TCP server, Symbian Client connection problem

    I don't see why it shouldn't. No matter whether the server is listening well in advance or not, that shouldn't make any difference. This could (probably) be raising some other problem in your code.

Similar Threads

  1. j2se server j2me client bluetooth connection problem
    By bepolat in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2010-07-14, 11:05
  2. Failed to connect a TCP client app with a server
    By abolfoooud in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2008-08-24, 07:47
  3. Problems with socket connection between client and server
    By Al_KaRaJo in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2006-11-15, 18:28
  4. Installation is denied by Java server (On Symbian phones)
    By nepher in forum Mobile Java General
    Replies: 2
    Last Post: 2006-11-07, 09:31
  5. Closing TCP connection by remote server
    By mkeke in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2004-08-31, 17:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×