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.


Topics - Linuxxon

Pages: [1]
1
Network / Looping through clients with TCP selector
« on: March 26, 2012, 10:12:12 am »
Can't find anything on how to loop through a tcp selector without them having to send packets to make the socket ready.

I want to be able to send packets to them...

2
Network / UDP socket
« on: February 13, 2012, 08:23:18 am »
I'm writing a client/server interface for a game my friends and I are working on and have stumbled upon a couple of problems.

First one:
Whenever I call receive on my listening UDP socket and no data has been sent to the server it receives from 255.255.255.255, is that normal?

Second one:
After a while of receiving data from a client it just stops to listen (I think, don't exactly know what's wrong). I can still send data to my client (from another socket) but it doesn't react to any received data and it's always random. Sometimes I'm able to send 50 and sometimes it just handles three.

Here is a paste of how I handle incoming connections http://pastebin.com/LGaSQRKz

3
Network / Using UDP sockets with graphics packet
« on: October 21, 2011, 06:30:37 pm »
When I send a regular packet containing an int and two strings between these two loops everything works fine.

Code: [Select]
sf::Packet Packet;
    sf::IPAddress IP;
    unsigned short Port;

    std::cout << "Waiting for clients..." << std::endl;
    Socket.Receive(Packet, IP, Port);
    std::cout << "Connection received!" << std::endl;

    int Type;

    if (Packet >> Type == 1)
    {
        std::string userName, Password;

        Packet >> userName >> Password;

        std::cout << "Username: " << userName << " Password: " << Password << std::endl;
    }

Code: [Select]
       sf::SocketUDP UDP;

        sf::Packet testPacket;
        int Type = 1;
        std::string userName = "00";
        std::string password = "00";

        std::cout << "Enter username: ";
        std::getline(std::cin, userName);
        std::cout << "Enter password: ";
        std::getline(std::cin, password);

        sf::IPAddress Address = "127.0.0.1";
        unsigned short portNr = 4639;

        testPacket << Type << userName << password;
        UDP.Send(testPacket, Address, portNr);
        std::cout << "Sent Login to " << Address << ":" << portNr << std::endl;


But when I have the same client code within a client rendering a window the socket doesen't go through to the server.

The client renders a single frame with a loaded image then pauses for input from user, that's the only difference between the client I want to use and this code...

So do anyone have an idea why this would be?

4
General / Getting Linker errors trying to install 1.6 VS2010
« on: March 04, 2011, 10:49:49 pm »
Hi, so I'm getting linker errors from the first windows tutorial in the 1.6 section...

The first sf::Clock tutorial works but when I follow the window tutorial I get these errors:
Code: [Select]
1>------ Build started: Project: SFML-Test, Configuration: Debug Win32 ------
1>  main.cpp
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>E:\C++\SFML-Test\Debug\SFML-Test.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Here is the source of the program (grabbed from the tutorial)
Code: [Select]
#include <SFML/Window.hpp>

int main()
{
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
bool Running = true;
while (Running)
{
   App.Display();
}

return EXIT_SUCCESS;
}


I've recompiled the libraries and added the "sfml-system-s-d.lib;sfml-main.lib;" to the Input under Linker in the project options. I've also added the "SFML_DYNAMIC" to the preprocessor.

I use Win7 x64 with VS2010.

I'd really like to start using SFML :)[/code]

Pages: [1]