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

Pages: [1]
1
Graphics / problem with second monitor
« on: September 12, 2007, 03:20:03 pm »
all ours sdl + opengl program working gine with the dual monitor setup

2
Graphics / problem with second monitor
« on: September 05, 2007, 04:20:20 pm »
it was on windows xp sp2

3
Graphics / problem with second monitor
« on: September 01, 2007, 12:27:40 pm »
one of the colleague with dualview setup complaint that sfml's opengl examples dont work on second monitor, the visual will turn into black and white on second monitor. the example he has tested are opengl and postfx. the graphics card he used is nvidia 7 series.

4
Network / return udp source port number to application layer
« on: August 23, 2007, 04:21:11 am »
i'm glad that i could contribute to the open source community.

5
Network / return udp source port number to application layer
« on: August 22, 2007, 05:59:46 pm »
is hard to find an exact document to explain it, i'll try to explain it myself. if you look at the udp header diagram  http://www.erg.abdn.ac.uk/users/gorry/course/inet-pages/udp.html
you could see there are two fields in the header, one for source port and one for destination port, so having source and destination port with different number is not an issue.

regarding the problem you can't get your example to work with different port numbers, i guess this is what you did

Code: [Select]

    if (Who == 's')
    {
        // Run as a server
        if (Protocol == 't')
            DoServerTCP(PortA); // was Port
        else
            DoServerUDP(PortA); // was Port
    }
    else
    {
        // Run as a client
        if (Protocol == 't')
            DoClientTCP(PortB); // was Port
        else
            DoClientUDP(PortB); // was Port
    }


doing these won't help you to set source and destination ports to different number, because the PortA is used to set the server's source port number and PortB is used to set the client's destination port number, therfore they have to be the same.

to make it works you need to send two port numbers to DoClientUDP(), for example

Code: [Select]

DoClientUDP(PortB, PortA);
...
void SocketUDP::Create()
{
...
   mySocket = socket(AF_INET, SOCK_DGRAM, 0);
   ret= bind(mySocket , PortB);
...
}

...

bool SocketUDP::Send(const char* Data, std::size_t Size, const IPAddress& Address, unsigned short PortA)
{
...

        Target.sin_family      = AF_INET;
        Target.sin_port        = htons(PortA);
        Target.sin_addr.s_addr = inet_addr(Address.ToString().c_str());
...
}


i believe this will work, but i didn't try this, because i used my existing client and only use sfml to program a new server.

Quote

PS : you don't need to do so many changes in the code, just pass the last parameter of sfSocketUDP::Receive (the port) by reference so that the function can overwrite it and pass it back to the caller.

i try not to do this, because it might break the existing code, if someone reuse the "port" without knowing it has been "corrupted"

6
Network / return udp source port number to application layer
« on: August 22, 2007, 02:41:30 pm »
Exactly, that's the situation i'm facing, that's why i'd to make this ugly hack

7
Network / return udp source port number to application layer
« on: August 22, 2007, 04:52:03 am »
the port number i needed to know isn't the port it bound to, but the port of the remote pc, the sender used port number. for my application, the receiver and sender are using different port number, different from the example you wrote.

8
Network / return udp source port number to application layer
« on: August 21, 2007, 04:47:30 pm »
i did a quick hack to fulfil my own needs, i post it here hopefully some one could benefit from it, and even get it merge into official code base.

modified these two lines in Network/ipaddress.hpp
Code: [Select]

    IPAddress(const std::string& Address, Uint16 port = 0);
    IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3, Uint16 port = 0);


and add these lines into Network/ipaddress.hpp
Code: [Select]

Uint16 getPort() const { return myPort; }

void setPort(Uint16 port) { myPort = port; }
...
private:
Uint16 myPort;


modified these lines in Network/ipaddress.cpp
Code: [Select]

IPAddress::IPAddress(const std::string& Address, Uint16 port) :
myPort(port)
{
...
}

IPAddress::IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3, Uint16 port) :
myPort(port)
{
...
}


add this line into Network/SocketUDP.cpp in method SocketUDP::Receive()
Code: [Select]

Address.setPort(htons(Sender.sin_port));


actually many things need to modified with this new changes, for example
Code: [Select]

bool SocketTCP::Connect(unsigned short Port, const IPAddress& HostAddress)


can be simplified to

Code: [Select]

bool SocketTCP::Connect(const IPAddress& HostAddress)


but since this is a quick hack, i leave it to you.

9
Network / return udp source port number to application layer
« on: August 19, 2007, 07:53:33 pm »
i wish the source port number will be exposed to application layer, from what i learn, current sfml implementation, only the source ip is returning back to application layer.

my convention: source == sender, dest == receiver  :), what i'm trying to do is to get sender port number at the receiver end.

10
General discussions / unicode support
« on: August 19, 2007, 03:34:08 am »
i downloaded and tested the svn version, but i couldn't find the sfString chinese characters example. besides this i also found out all the openal related example crashed on my pc, that's happened when i exiting the example. i believe this is caused by mismatch of openal dll and lib. i'm using the latest precompiled sdk version from creative website. i hope you could check in your openal dll into svn for me to confirm the problem.

In case you like the detail, this's the location where they crashed
Code: [Select]

sfAudioDevice::~sfAudioDevice()
{
    // Destroy all device-dependant resources
    std::for_each(myResources.begin(), myResources.end(), std::mem_fun(&sfAudioResource::DestroyAudioResources));

    // Destroy the context
    alcMakeContextCurrent(NULL); // access violation reading location 0xXXXXX
    if (myContext)
        alcDestroyContext(myContext);

    // Destroy the device
    if (myDevice)
        alcCloseDevice(myDevice);
}


btw, i hope you could set vc2005 project property "configuration properties/debugging/working directory" to $(TargetDir). i hope this could make anyone use the svn version  easier to debug. thanks

11
General discussions / unicode support
« on: August 14, 2007, 01:35:01 pm »
that'll be great! if possible do something similar to this http://sdl-im.csie.net/SDL_imm/index.html

12
General discussions / unicode support
« on: August 14, 2007, 11:54:35 am »
too bad, most of my projects are required multilingual support, but i really like SFML design especially the ability to embed SFML into standard win32 controls.

keep up the good work, i aready bookmarked your homepage, and will check your progress from time to time

13
General discussions / unicode support
« on: August 14, 2007, 09:58:04 am »
sorry i still don't quite get it, does it means that on win32 both unicode display (by using truetype font) and unicode input (fareast characters) are supported?

i know the best way to find out is to test it myself, please forgive my laziness  :oops:

14
General discussions / unicode support
« on: August 14, 2007, 05:09:18 am »
does SFML support unicode? if it wasn't, will it be in SFML's road map?

Pages: [1]
anything