SFML community forums

Help => Network => Topic started by: Dean404 on June 17, 2015, 06:57:11 pm

Title: Packet receives empty string
Post by: Dean404 on June 17, 2015, 06:57:11 pm
string_to_send = "P";
packetSend << string_to_send << pointer_x << pointer_y;
                                globalMutex.unlock();
                                socket.send(packetSend);
Sending code
if (packetReceive >> new_building >> new_x >> new_y)
                {
                                        map[new_y][new_x] = new_building;                                      
                                        SomethingChanged = true;
                }
Receiving code.
And new_building equals nothing. Please, tell me, what am I doing wrong here. new_x and new_y are all right, though.
Title: Re: Packet receives empty string
Post by: iride on June 17, 2015, 09:48:41 pm
I think the new_building has to be char *
Title: Re: Packet receives empty string
Post by: Dean404 on June 17, 2015, 09:58:46 pm
I think the new_building has to be char *
Nope, it's still nothing.
(http://dl1.joxi.net/drive/0005/0067/331843/150617/57242cc70e.png)
Title: Re: Packet receives empty string
Post by: eXpl0it3r on June 17, 2015, 10:05:53 pm
Provide a minimal and compilable example code (http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368).
Title: Re: Packet receives empty string
Post by: Dean404 on June 17, 2015, 10:13:25 pm
Here's the separate programm, that has to send std::string through packet:
(click to show/hide)
And here is the result:
(click to show/hide)
(The last line is "Press any button to continue..." in russian)
Title: Re: Packet receives empty string
Post by: iride on June 18, 2015, 02:45:50 am
your code works fine on my computer.
(http://i.imgur.com/aoh5qdx.png?1)
Title: Re: Packet receives empty string
Post by: Dean404 on June 18, 2015, 03:05:34 am
Oh lol, i am so stupid, forgot to add sfml-network.lib. Working fine now.