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 - djmentos

Pages: [1]
1
Network / Try to use UDP.
« on: September 19, 2010, 07:54:23 pm »
Thanks, it's work.

But now i have another question to UDP. In case of UDP dont have 'connections', client need to have public IP or is it any way to resend to him a packet from server?

2
Network / Try to use UDP.
« on: September 19, 2010, 12:06:39 pm »
Ok, updated code in upper post. ITs whole main()

3
Network / Try to use UDP.
« on: September 19, 2010, 11:42:24 am »
So now it looks:
Code: [Select]

 SocketUDP Server;

    if (!Server.Bind(1337))
    {
        cout << "Pierdolony error!" << endl;
    }

    cout << "Init Zayebista Server" << endl;

    IPAddress SenderIP;
    unsigned short SenderPort;

    while (true)
    {
        sf::Packet Packet;
        if (Server.Receive(Packet, SenderIP, SenderPort) == sf::Socket::Done)
        {
            // Extract the message and display it
            float    x;
            float    y;
            Packet >> x >> y;
            std::cout << SenderIP << ":"<< SenderPort << " " << x << " " << y << std::endl;
        }

    }

    Server.Close();

And server dont get any message from client.

4
Network / Try to use UDP.
« on: September 18, 2010, 08:39:08 pm »
Hi.

I try to make client and server on UDP.

Client:
Code: [Select]

    int ServPort = 1337; //Port Servera
    IPAddress ServIP("127.0.0.1"); //IP Servera, moze byc HOST

    if (!ServIP.IsValid()){
        cout << "Niepoprawny adres serwera" << endl;
    }

    SocketUDP Client;
    char Message[] = "Hi, I'm a client !";

    if (Client.Send(Message, sizeof(Message), ServIP, ServPort) != Socket::Done)
        cout << "Pierdolony error!" << endl;
    else
        cout << "Message sent to server : \"" << Message << "\"" << endl;

    Client.Close();


and Server:
Code: [Select]

IPAddress SenderIP;
unsigned short SenderPort;

    while (true)
    {
        unsigned int NbSockets = Selector.Wait();

        for (unsigned int i = 0; i < NbSockets; ++i)
        {
            SocketUDP Socket = Selector.GetSocketReady(i);

            sf::Packet Packet;
            if (Socket.Receive(Packet, SenderIP, SenderPort) == sf::Socket::Done)
            {
                // Extract the message and display it
                float    x;
                float    y;
                Packet >> x >> y;
                std::cout << SenderIP << ":"<< SenderPort << " " << x << " " << y << std::endl;
            }
            else
            {
                // Error : we'd better remove the socket from the selector
                Selector.Remove(Socket);
            }
        }

    }


And server dont gets a message from client. Whats wrong?

5
General / Slow moving of sprite with background
« on: June 08, 2010, 06:39:14 pm »
i have the same problem, and its not problem of hardware and software. When i comment a line:
Code: [Select]
App.Draw(Background);
all is right. so something wrong is with background?

it's jpg 800 x 600

6
General / Tutorial doesnt work
« on: May 29, 2010, 07:58:56 am »
Win Vista, intergrated, not ATI (Intel).

7
General / Tutorial doesnt work
« on: May 28, 2010, 10:29:15 pm »
1.7

8
General / Tutorial doesnt work
« on: May 28, 2010, 10:10:50 pm »
hi.

i copied a code from tutorial:
Code: [Select]

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
   
    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        App.Clear(sf::Color(200, 0, 0));
        App.Display();
    }

    return EXIT_SUCCESS;
}

And the main while dont work but if i del line:

        App.Clear(sf::Color(200, 0, 0));

all is right.

Pages: [1]