User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Not connected to a server

  1. #1
    No Products Registered

    Join Date
    Dec 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Not connected to a server

    I used Lacewing C++ library to create my server and client with MFC and found the client can't connect to the localhost server.

    server side
    Lacewing::Server myServer;
    ......
    myServer.RegisterHandlerSetName(HandlerSetName);
    myServer.Host(9121);
    bool bHosting = myServer.Hosting();
    int pot = myServer.Port();
    It seems working well


    client side
    Lacewing::Client myClient;
    ......
    myClient.RegisterHandlerChannelListComplete(Handle rChannelListComplete);
    myClient.Connect("localhost", 9121);
    const char* ip = myClient.ServerIP();
    int port = myClient.ServerPort();
    I got the empty ip and -1 port.

    What's wrong with it? I missed something?

  2. #2
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Not connected to a server

    Connect() isn't blocking. You need to register the connect handler and wait for that.

  3. #3
    No Products Registered

    Join Date
    Dec 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Not connected to a server

    Quote Originally Posted by Jamie
    Connect() isn't blocking. You need to register the connect handler and wait for that.
    Thanks Jamie.
    But I came across the another problem. When I get an error in error handler, I want to iterate error code like the following,
    for(int ID = Error.ErrorCodeLoop(); ID; ID = Error.ErrorCodeLoop(ID))
    {
    Lacewing::ErrorCode::Type ErrorCode = Error.ErrorCodeLoopIndex(ID);

    // cout << "Error: " << Lacewing::ErrorCode::ToString(ErrorCode) << endl;
    }

    But I got link errors

    1>*****.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: enum Lacewing::ErrorCode::Type __thiscall Lacewing::Error::ErrorCodeLoopIndex(int)" (__imp_?ErrorCodeLoopIndex@Error@Lacewing@@QAE?AW4 Type@ErrorCode@2@H@Z) referenced in function "void __cdecl HandlerError(class Lacewing::Client &,class Lacewing::Error &)" (?HandlerError@@YAXAAVClient@Lacewing@@AAVError@2@ @Z)
    1>*****.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall Lacewing::Error::ErrorCodeLoop(int)" (__imp_?ErrorCodeLoop@Error@Lacewing@@QAEHH@Z) referenced in function "void __cdecl HandlerError(class Lacewing::Client &,class Lacewing::Error &)" (?HandlerError@@YAXAAVClient@Lacewing@@AAVError@2@ @Z)

    I am not sure whether the two functions correctly exported in the library, since no linking error for Error.ToString()

    One more question,
    in class Client, Send a file to the server,
    LacewingFunction File * SendFile(int Subchannel, const char * Filename);
    Could you explain what the parameter Subchannel is? And How do I set it?
    Please forgive me for the silly questions, I am a newbie here.
    Thank you in advance again.

  4. #4
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Not connected to a server

    Ah, you're right, looks like I didn't export them. Error.ToString() gives you a string representation of the entire error (it loops through itself) so you might be alright with that for now.

    That SendFile function in the Client class shouldn't even be there - the Lacewing protocol has no mechanism for file transfer. The only way to send a file currently is to send it in chunks with Send().

    By the way - there's a big update coming to the C++ library soon (Q1 2011), and the library is also going open source.

  5. #5
    No Products Registered

    Join Date
    Dec 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Not connected to a server

    Regarding Send in class Client, what the maximum size can it send at a time?

    Looking forward to the new release.

  6. #6
    No Products Registered

    Join Date
    Dec 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Not connected to a server

    One more question, I found when the client software crash and offline accidentally, the server doesn't trigger the disconnect handler. Should I create a timer on server to send ping to the client to make sure the client connected?

  7. #7
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Not connected to a server

    Quote Originally Posted by Ziyoo
    Regarding Send in class Client, what the maximum size can it send at a time?

    Looking forward to the new release.
    Hmm, I wouldn't try sending more than 60 KB in the current build.

    Quote Originally Posted by Ziyoo
    One more question, I found when the client software crash and offline accidentally, the server doesn't trigger the disconnect handler. Should I create a timer on server to send ping to the client to make sure the client connected?
    It's meant to do that automatically - it definitely does in the new build. I guess sending them yourself is an acceptable workaround for now, yes.

  8. #8
    Clicker Multimedia Fusion 2
    Greg's Avatar
    Join Date
    Dec 2006
    Location
    Poland
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Not connected to a server

    Quote Originally Posted by Jamie
    it definitely does in the new build.
    By "new" you mean 18 or 17?

  9. #9
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Not connected to a server

    The unreleased one.

  10. #10
    Clicker Multimedia Fusion 2
    Greg's Avatar
    Join Date
    Dec 2006
    Location
    Poland
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Not connected to a server

    I'm getting this problem, too... If client stays idle for something about 5 minutes the server doesn't trigger the disconnect handler and after that the server stops working, just nobody can join...

    I have my server as a console app in Visual C++ 2010. Could somebody help me and tell me how to create an event or something what would ping each client every few minutes?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. [Bug] Is Network Connected?
    By ProdigyX in forum Android Export Module Version 2.0
    Replies: 3
    Last Post: 20th March 2013, 10:17 AM
  2. Find connected actives
    By OveMelaa in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 19th September 2008, 07:18 PM
  3. How to check if you are connected to the internet?
    By ClickerGuy in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 12th October 2007, 11:39 PM

Posting Permissions

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