Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mourtaza

Pages: [1]
1
Network / Probleme with TcpSocket::Receive
« on: March 02, 2012, 07:07:19 pm »
Thanks, I find it by the way, finally I suceed, my windows are displayed etc.. all it's ok but it don't work good if I press 2 keys at the same time, just one key is "seen" by the server, is it normal ? Should I post the code ?

2
Network / Probleme with TcpSocket::Receive
« on: March 02, 2012, 05:33:49 pm »
non blocking-socket = UDP Socket ?

I was just trying to do it in a Thread, but my socket is not declared in this thread, so I try to write in the parameters of my thread, as a reference or not. But I have an error which says that the constructor of NonCopyable is private.

3
Network / Probleme with TcpSocket::Receive
« on: March 02, 2012, 02:16:46 pm »
I think

Code: [Select]
app.Clear();
.....
app.Display();
is never call. If I don't write this condition :

Code: [Select]
if(mySocket.Receive(paquet) == Socket::Done)
{
......
}


There is no problem to move my character and display the window etc..
But if I don't write it, I can"t move the other character by receiving packet from my server.

4
Network / Probleme with TcpSocket::Receive
« on: March 02, 2012, 12:18:44 pm »
I tried with

Code: [Select]
if(mySocket.Receive(paquet) == Socket::Done)

but it's there's the same problem.

5
Network / Probleme with TcpSocket::Receive
« on: March 01, 2012, 11:11:03 pm »
Hello everybody, I am coding one simple application and I have a problem with this code :

Code: [Select]
#include<SFML/Graphics.hpp>
#include<SFML/Network.hpp>
#include<iostream>
#include<string>
#include"Naruto.h"
    using namespace sf;
    using namespace std;
int main(void)
{
    RenderWindow app(VideoMode(800,600,32),"Naruto");
    TcpSocket mySocket;
        bool connexion(true);
        while(connexion)
        {
            if(mySocket.Connect("192.168.1.176",5000) == Socket::Done)
                connexion = false;
        }
        Naruto naruto("Image/NarutoNormal.bmp");
            naruto.changerPosition(400,100);

        Naruto sakura("Image/SakuraNormal.bmp");
            sakura.changerPosition(400,400);

        Texture terrTxt;
            terrTxt.LoadFromFile("Image/terrain.bmp");
                Sprite terrain;
                    terrain.SetTexture(terrTxt);

    while(app.IsOpen())
    {
        Event event;
            while(app.PollEvent(event))
            {
                if(event.Type == Event::Closed)
                    app.Close();
                Packet paquet;

                if(Keyboard::IsKeyPressed(Keyboard::Up))
                {
                    naruto.avancer();
                    paquet << "haut";
                    mySocket.Send(paquet);
                    paquet.Clear();

                }
                if(Keyboard::IsKeyPressed(Keyboard::Down))
                {
                    naruto.reculer();
                    paquet << "bas";
                    mySocket.Send(paquet);
                    paquet.Clear();

                }
                if(Keyboard::IsKeyPressed(Keyboard::Left))
                {
                    naruto.allerAGauche();
                    paquet << "gauche";
                    mySocket.Send(paquet);
                    paquet.Clear();
                }
                if(Keyboard::IsKeyPressed(Keyboard::Right))
                {
                    naruto.allerADroite();
                    paquet << "droite";
                    mySocket.Send(paquet);
                    paquet.Clear();
                }
                string myText("");
                if(mySocket.Receive(paquet))
                {
                    paquet >> myText;
                }

            }
        app.Clear();
        app.Draw(terrain);
        app.Draw(naruto.getPersonnage());
        app.Draw(sakura.getPersonnage());
        app.Display();
    }
    return EXIT_SUCCESS;
}


The probleme is at the reception of a packet just before clearing the window etc...
My window is always "transparent" , it did not display what he does.
I think, and I know that there is a problem in the reception of a packet, but what ? Even if i don't write anything in this condition.

Pages: [1]