Results 1 to 6 of 6

Thread: Networking & Logging

  1. #1
    Serf
    Join Date
    Feb 2007
    Posts
    4

    Default Networking & Logging

    Using 0.8.0, I'm having a problem getting the network code to work. The two clients happily have connect/disconnect messages, but sending netpackets is not working:

    code I'm using to send:
    CL_NetPacket packet;
    packet.output.write_string(str);
    server.send("test", packet);

    receiving the signal:
    slots.connect(netsession.sig_netpacket_receive("te st"), this, &testServer:n_netpacket);


    --

    My second issue is connecting the log to some output. I'm not really sure how to manipulate signals/slots to do this for me, could someone give me a hand here?

    Thanks

  2. #2
    Squire
    Join Date
    Jan 2007
    Posts
    28

    Default

    Seems like you have a channel "test" and a channel "te st" or is it just a typo?


    log output something like

    class CLLogOut {
    CL_Slot lslot;
    void putout(std::string &s1,int x,std::string &s2) { std::cout << s2 << " (" << x << "): " << s1; }
    CLLogOut() : lslot() { lslot = CL_Log::sig_log().connect(this,&CLLogOut:utout); }
    };

    As long as you have an instance of it around you have output of clanlog.

  3. #3
    Serf
    Join Date
    Feb 2007
    Posts
    4

    Default

    The space is not in the actual code -- I assume it is the forum breaking long lines.
    ---
    I switched over to using the Demo netsessions code, which worked absolutely fine locally (as I believe my original code did). However, deploying the same code to my linux server causes the messages to not get passed to the client (the log writes no messages).

    I confirmed through telnet that the messages are indeed being sent by the server (so it isn't some firewall issue), and the client still connects/disconnects.

    I obviously have updated the connection lines to
    CL_IPAddress server_ip;
    server_ip.set_address("(server)", "7667");
    netgame->connect(server_ip);

    Thoughts?

    Thanks

  4. #4
    Serf
    Join Date
    Feb 2007
    Posts
    4

    Default

    I had some time to do some debugging in xcode & gdb and it seems like the call on netcomputer_generic:462 to tcp_sock.input.read_string() is never completed when I connect to my linux server, while it is when I am locally connected.

    459-466 is reproduced below:
    Code:
    case cmd_create_atom:
    				{
    					int atom_id = tcp_sock.input.read_ushort16();
    					std::string atom_str = tcp_sock.input.read_string();
    
    					remote_atoms[atom_id] = atom_str;
    				}
    				break;
    I certainly don't have enough knowledge of sockets to do much more debugging, does anyone have any idea why this would be the case?

  5. #5
    Serf
    Join Date
    Feb 2007
    Posts
    4

    Default

    After further testing, I believe it to be a problem with endian-ness -- it seems as if the inputsource code does not account/compensate for different endians across the network. Is this plausible/easily fixable/etc?

  6. #6
    Peasant
    Join Date
    May 2007
    Posts
    9

    Default

    Networking definitely has endian issues. Default endian mode in 0.8.0 is system endian mode. So all the NetSession code is broken since it internally uses the local endian mode for retreiving packet numbers, strings etc.

    A global switch for setting endianness in all the inputsource and outputsource classes would help already. Until then, I can't use ClanLib for networking since I'm developing on PowerPC OS X and Windows.

Similar Threads

  1. Presumed buffer overflow when printing/logging very long lines
    By Ian in forum Novashell Game Creation System
    Replies: 0
    Last Post: 01-09-2007, 02:10 AM

Bookmarks

Bookmarks

Posting Permissions

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