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

Pages: [1]
1
Graphics / Double-free bug in SFML2 (at least on OS X)
« on: January 15, 2012, 11:18:44 am »
Thanks for replies. I didn't go through the issues list, sorry about that. Good to know that the problem lies in Apple's side, although it may take a long time before they will fix it, or if they will...

2
Graphics / Double-free bug in SFML2 (at least on OS X)
« on: January 15, 2012, 01:13:11 am »
Hi. I compiled SFML2 main branch (from github) today, and discovered a bug that is caused by freeing a non-allocated pointer. The bug occurs after initializing a empty sf::String and when the program is calling its destructor:
Code: [Select]
#include <SFML/System.hpp>
int main()
{
    sf::String s;
    return 0;
}

Code: [Select]
~ ยป ./a.out                                                    
a.out(27893) malloc: *** error for object 0x100035300: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug


I did a quick glance through SFML's source code, but discovered nothing suspicious. sf::String is just a wrapper around std::basic_string<Uint32> after all...
I'm running OS X 10.6.8, SFML and the executable is in x86_64. Compiling the program in i386 architecture made no difference. I haven't been able to test this on other machines yet.

3
Network / Usage of sf::Socket::Status in non-blocking sockets?
« on: January 31, 2011, 10:07:04 pm »
Any news regarding to the issue?

4
Network / Problem with UDP Sockets
« on: January 25, 2011, 10:00:57 am »
No, I think that's not correct. According to the API you need to provide the port on which the remote computer sent the data.

5
Network / Problem with UDP Sockets
« on: January 25, 2011, 01:11:20 am »
A thing that caught my eye was that you declare an integer called porty, and use it without initializing it. Dunno if that's the problem though.

6
Network / Simple Test Not Working (I'm a noob)
« on: January 25, 2011, 01:05:27 am »
Great explanation, thanks. :) Just to add some more, your router has only one public ip which other people can see from the internet. The problem is that beneath that public ip, you can have multiple computers with local ip:s. Because of that, the router doesn't know which local ip (computer) the data needs to be sent (which computer runs the server in the local network), unless you tell the router that by forwarding the port.

The forwarding process is quite easy, and does not need any advanced knowledge of the Internet. There's probably a tutorial lying around, if you google your router model + 'port forwarding'.

I drew a (ugly) picture from the situation. (Click to open a bigger one.)


The situation is now that the router (the big question mark box) has an incoming data to port 4567, and it doesn't know what to do before it is given the port forward rule (the green text). After that it knows to send the data to the corresponding local ip (the green arrow).

7
Network / Simple Test Not Working (I'm a noob)
« on: January 24, 2011, 09:40:54 am »
You should forward the port you're using (4567) from your router settings to your local ip where the server is running. See more: www.portforward.com

8
Network / Simple Test Not Working (I'm a noob)
« on: January 20, 2011, 10:19:38 am »
It's working for me (at least if you fix the "std<<cout" in client.cpp :P). Are you sure that you use localhost or 127.0.0.1 as an ip if you're testing in your home network? (Client and the server on the same computer).

9
Network / Usage of sf::Socket::Status in non-blocking sockets?
« on: January 18, 2011, 09:54:57 am »
The following code:
Code: [Select]
#include <SFML/Network.hpp>
#include <iostream>

int main() {
  sf::IpAddress ip("localhost");
  sf::UdpSocket socket;
  sf::Packet packet;
  sf::Socket::Status socket_status = sf::Socket::Done;
  sf::Socket::Status receive_status = sf::Socket::Done;
  unsigned short port = 55555;

  socket.Bind(sf::UdpSocket::Socket::AnyPort);
  socket.SetBlocking(false);

  while (true) {
    socket_status = socket.Send(packet, ip, port);

    if (receive_status==0) {
      receive_status = socket.Receive(packet,ip,port);
      std::cout << "Received." << std::endl;
    }

    std::cout << "Socket status is: " << socket_status << std::endl;
    std::cout << "Receive status is: " << receive_status << std::endl;

    if (!socket_status==0)
      return 1;

    packet.Clear();
  }

}


Produces following output (on Mac OS X 10.6.6):
Code: [Select]
Socket status is: 0
Receive status is: 1
Socket status is: 3
Receive status is: 1


Strangely, I found out that if I comment out the receive part (even if it is not called even once), both statuses are always 0. I don't know how what output Windows does, because I don't have a Windows computer around, but I'll post it too later on, if needed. I didn't have any server running when doing this test, but it shouldn't affect the outcome, should it?

Is this a bug or is it my code? :) Thanks for your help.

10
Network / Usage of sf::Socket::Status in non-blocking sockets?
« on: January 17, 2011, 05:15:49 pm »
Hi. I'm using SFML2 in my project and non-blocking UDP socket. According to the API, I should get enum code 1 (NotReady), when I send data when the previous data hasn't been completely sent yet, do I understand this correctly?

When I run the code (just sending data in a loop), on OS X, I get enum code 3 (Error) when the previous data hasn't been sent yet. On Windows, I get 0 (Done) all the time. Either there's a bug in the library, or I'm just understanding the whole thing wrong. Receiving works correctly afaik.

11
Network / Any way to resolve local UDP port in SFML 1.6?
« on: December 15, 2010, 09:43:33 am »
Thanks for the answer. I tried binding it to 0, with no luck. Strange, I thought this was kind of a basic functionality, but I'll test the 2.0 out then.

12
Network / Any way to resolve local UDP port in SFML 1.6?
« on: December 15, 2010, 01:48:16 am »
Hi. I'm starting out with SFML and the networking side of it. My question is following: Am I able to resolve the local port that is used by sf::SocketUDP? I took a look at the SFML2.0 api, which has this method, which will eventually return the port I'm after. But is there a way to do that in 1.6?

I'm a complete beginner what comes to networking, so I'll explain a little more why I think I need that port.

Server binds a port (in my test case 51337). When client sends something to that port, it sends it via another free port, which is assigned to it by operating system. Right? So if server returns something to client after getting the packet from client, it replies it to the port that the data came from. But if the client wants to receive that data that server just sent, it needs to bind the socket it's using. And because I cant resolve the local port, I'll need to manually bind some port, which causes problems if I run another client and it uses the same port.

Does my thinking make any sense, or am I completely lost? :D Thanks for advance.

(I'm using SFML 1.6, C++ and Mac OS X 10.6)

Pages: [1]
anything