It would be great if you can provide an example.Fantastic work Medo. I was rather surprised that there wasn't a new example using UDP. It's easy enough for myself, but I can imagine new people to Faucet or online programming in general may struggle without something to look at. Can people expect an example in the future? If I get some more time I could possibly make one I suppose
Faucet Networking
#61
Posted 27 July 2011 - 08:10 PM
#62
Posted 03 August 2011 - 06:26 PM
I tried the udp connection and it's a really cool stuff. Fast and easy to use.
My only problem is: I created a server on my computer and a friend tried to connect with udp from an other network. He has got a router and his computer is behind this router. The server tried to send data in udp with udp_send(buffer,ip,port), where the ip is the router's ip address. (80.76. ...) His computer's ip is 192.168.0.2 behind the router and there is an other computer in the network with this ip: 192.168.0.1. Of course, my data never arrived to my friend's computer and the game crashed, because the router didn't know where to transmit the data. My question is: how can I target his IP address behind a router? It would be great if many players could connect behind the same router and the server should send them different data with udp connection. So what should I do?
By the way, great job, I'm looking for updates.
#63
Posted 03 August 2011 - 06:49 PM
You can't do this directly. Instead, you have two options. First, you can set up the router to forward certain ports to specific machines on your network. How you go about that depends on the router. The second option is to use NAT punchthrough (see e.g. http://www.mindcontr.../nat-punch.html), but that is a bit tricky and requires an "introducer" server that isn't behind a NAT router itself.Hi!
I tried the udp connection and it's a really cool stuff. Fast and easy to use.
My only problem is: I created a server on my computer and a friend tried to connect with udp from an other network. He has got a router and his computer is behind this router. The server tried to send data in udp with udp_send(buffer,ip,port), where the ip is the router's ip address. (80.76. ...) His computer's ip is 192.168.0.2 behind the router and there is an other computer in the network with this ip: 192.168.0.1. Of course, my data never arrived to my friend's computer and the game crashed, because the router didn't know where to transmit the data. My question is: how can I target his IP address behind a router? It would be great if many players could connect behind the same router and the server should send them different data with udp connection. So what should I do?
By the way, great job, I'm looking for updates.
#64
Posted 07 August 2011 - 12:03 PM
These examples you gave me are still too complicated. xD
#65
Posted 18 August 2011 - 10:35 PM
Well, I haven't got an introducer server, so the other option left. But I'm afraid I don't really understand you.You can't do this directly. Instead, you have two options. First, you can set up the router to forward certain ports to specific machines on your network. How you go about that depends on the router. The second option is to use NAT punchthrough (see e.g. http://www.mindcontr.../nat-punch.html), but that is a bit tricky and requires an "introducer" server that isn't behind a NAT router itself.
Hi!
I tried the udp connection and it's a really cool stuff. Fast and easy to use.
My only problem is: I created a server on my computer and a friend tried to connect with udp from an other network. He has got a router and his computer is behind this router. The server tried to send data in udp with udp_send(buffer,ip,port), where the ip is the router's ip address. (80.76. ...) His computer's ip is 192.168.0.2 behind the router and there is an other computer in the network with this ip: 192.168.0.1. Of course, my data never arrived to my friend's computer and the game crashed, because the router didn't know where to transmit the data. My question is: how can I target his IP address behind a router? It would be great if many players could connect behind the same router and the server should send them different data with udp connection. So what should I do?
By the way, great job, I'm looking for updates.
I set up my (the server's) router to forward every ports on TCP and UDP. (14804 was for TCP and 14805 was for UDP.) And it just didn't work. I changed the game's codes, so now every client watches an own different port to recieve udp messages. So now the used ports are from 14805-14899 for UDP connection, but it doesn't work either. I used portforwarding and DMZ, too. (DMZ=forwards every port for one IP.) If a client is behind a router, the server just doesn't see it. The client didn't use portforwarding, but I don't see the point to use and it would be sad if this is the only option. Is it okay, if I use this command like this: udp_send(udp_buffer,'80.76.xxx.xx',14805) ? I just don't get it, please help!
#66
Posted 18 August 2011 - 10:51 PM
Your problem sounds more like a general networking question that isn't directly related to this extension, except for the last part - that udp_send call looks ok to me, assuming you don't actually have xxx.xx in the code.I set up my (the server's) router to forward every ports on TCP and UDP. (14804 was for TCP and 14805 was for UDP.) And it just didn't work. I changed the game's codes, so now every client watches an own different port to recieve udp messages. So now the used ports are from 14805-14899 for UDP connection, but it doesn't work either. I used portforwarding and DMZ, too. (DMZ=forwards every port for one IP.) If a client is behind a router, the server just doesn't see it. The client didn't use portforwarding, but I don't see the point to use and it would be sad if this is the only option. Is it okay, if I use this command like this: udp_send(udp_buffer,'80.76.xxx.xx',14805) ? I just don't get it, please help!
I suggest using wireshark to find out which packets arrive where. Apart from that, networking questions that are not directly related to the extension should go to a Q&A site like stackoverflow.com.
#67
Posted 19 August 2011 - 06:42 AM
Okay, I'll check and try to figure this out. Thanks.Your problem sounds more like a general networking question that isn't directly related to this extension, except for the last part - that udp_send call looks ok to me, assuming you don't actually have xxx.xx in the code.
I set up my (the server's) router to forward every ports on TCP and UDP. (14804 was for TCP and 14805 was for UDP.) And it just didn't work. I changed the game's codes, so now every client watches an own different port to recieve udp messages. So now the used ports are from 14805-14899 for UDP connection, but it doesn't work either. I used portforwarding and DMZ, too. (DMZ=forwards every port for one IP.) If a client is behind a router, the server just doesn't see it. The client didn't use portforwarding, but I don't see the point to use and it would be sad if this is the only option. Is it okay, if I use this command like this: udp_send(udp_buffer,'80.76.xxx.xx',14805) ? I just don't get it, please help!
I suggest using wireshark to find out which packets arrive where. Apart from that, networking questions that are not directly related to the extension should go to a Q&A site like stackoverflow.com.
#68
Posted 21 August 2011 - 10:21 AM
#69
Posted 21 August 2011 - 01:21 PM
No, the way you described is the best option at the moment. I wouldn't be too concerned about performance though, since buffer copies are very fast, especially compared to filling a buffer in GML code. I just wrote a small test which simply writes 8MB of data to a buffer with repeated calls to write_double. To compare, I then copied this buffer 30 times to another buffer. The copying still took less than 10% of the time that was spent filling the buffer with write_double.How can I send data to multiple client at once? In 39dll, I write data on 'one buffer' and send it via all sockets. But in Faucet networking, cuz all socket have its own buffer, I have to write data on 'one buffer' and then write_buffer for all socket's buffer again. Thus if there are 30 clients, I have to copy buffer 30 times. Is it only way to send same message to multiple clients simultaneously? I hope there is a better way to do it..
In other words, if the buffer content you are trying to send to everyone was created in GML, it is unlikely you will notice the performance difference created by the extra copying. And if you factor in that you'd have to write extra GML code in 39dll to ensure all your data is actually sent, the 39dll way of using nonblocking send calls without an extra buffer might even be slower (depending on buffer sizes). In any case, I'd need some convincing numbers to show this is actually a performance problem before I change anything about this.
#70
Posted 23 September 2011 - 06:44 PM
#71
Posted 30 September 2011 - 10:37 PM
There is a 39dll extension around (and turning any GM dll into an extension is easy), so this is not an actual advantage. Faucet Networking isn't just 39dll functions put in some wrapper though, it's a completely different implementation. The first post of this thread gives some overview of its advantages over 39dll, but the upshot is that Faucet Networking makes it easier to write correct nonblocking networking code. In addition, Faucet Networking is actively maintained, so if you find a bug it will actually be fixed.So except that this looks like a 39dll functions put into bigger functions whats an actual advantage of this to the + of being an extension on the plus side ? Cause i am making a large game 8000 lines of code already and i occasionally get super logical error and i am just searching for multiplayer that will be used, 39dll works fine for me, but i don't understand how to threat new instances...
Unfortunately I don't understand the second part of your post.
#72
Posted 05 October 2011 - 10:03 AM
Download here.
Yes, I completely skipped releasing V1.2 because it was such a small change
Here's what's new:
- Feature: New function write_buffer_part to append only a section of one buffer to another buffer
- Bugfix: TCP acceptors could stop working on non-critical problems (e.g. when the network connection was lost for a short time)
- Bugfix: Calling write_buffer() with the same buffer in both arguments could cause an illegal memory access
Edited by Medo42, 09 October 2011 - 09:34 AM.
#73
Posted 06 October 2011 - 03:40 PM
I look forward to using this.
#74
Posted 09 October 2011 - 09:04 AM
#75
Posted 20 October 2011 - 08:09 PM
#76
Posted 12 December 2011 - 11:24 AM
Dll call of the GM is a slow side.
write_ubyte(Socket, 1); write_ubyte(Socket, 5); write_ubyte(Socket, 7); write_ubyte(Socket, 8);
SO. This call is inefficient.
write_ubyte(Socket, 1, 5, 7, 8);
If this approach. you will get the simplicity and speed.
Edited by wnsrn3436, 12 December 2011 - 11:38 AM.
#77
Posted 12 December 2011 - 06:59 PM
This looks like a good idea which would simplify code in some situations, but as far as I know dll extension functions must have a fixed number of operands. That means we would either need to use different function names (e.g. write_ubyte_4(socket, 1, 5, 7, 8)) or fall back on variadic GML extension functions. This would cause additional overhead though and probably cancel any speed benefit you would get from this change.I have a new idea.
Dll call of the GM is a slow side.write_ubyte(Socket, 1); write_ubyte(Socket, 5); write_ubyte(Socket, 7); write_ubyte(Socket, 8);
SO. This call is inefficient.write_ubyte(Socket, 1, 5, 7, 8);
If this approach. you will get the simplicity and speed.
Alternatively, we can keep the current functions but add a new set with plural names, e.g. "write_ubytes" which would be variadic. This would ensure there is no performance penalty for the current usage, but still allow the more concise version where appropriate. However, I don't really like the redundancy this creates from an API viewpoint.
Before I start making decisions based on performance, I should better go benchmark the different options to get a clearer image of the situation and whether it actually matters much.
#78
Posted 15 December 2011 - 09:29 PM
i just tried to make a small test game with it and it appears that the buffer_write doesn't work or causes an error.
the pong example works fine but my little test chat program doesn't
http://www.mediafire...zzfp54b9p067r7x
I even used to get some run-time error about c++ but that's fixed now
Edited by wilbert, 15 December 2011 - 09:29 PM.
#79
Posted 15 December 2011 - 09:36 PM
I will look at your source. You should not get c++ runtime errors though, I would be very interested to see the game source that led to this error.multilayer is completely driving me crazy, 39dll causes all kinds of strange problems and this one too =[
i just tried to make a small test game with it and it appears that the buffer_write doesn't work or causes an error.
the pong example works fine but my little test chat program doesn't
http://www.mediafire.com/?zzfp54b9p067r7x
I even used to get some run-time error about c++ but that's fixed now
#80
Posted 15 December 2011 - 09:57 PM
i don't get the errors in this version of the of it anymore btw.
i might be able to recover an old .exe of it from skype but i don't have any gm files of it
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users









