Jump to content


Photo

Faucet Networking


  • Please log in to reply
381 replies to this topic

#101 Bytewin

Bytewin

    GMC Member

  • New Member
  • 92 posts
  • Version:GM8

Posted 30 December 2011 - 07:10 PM

Simple enough for a noob like me to understand.
But very powerful..
Nice! Keep on coding! :medieval:
  • 0

#102 MrRatermat

MrRatermat

    GMC Member

  • GMC Member
  • 6 posts
  • Version:GM8

Posted 02 January 2012 - 12:58 PM

I just joined this forum to say, THANK YOU! This has made things much easier!

Without this, i wouldn't bother even making multiplayer games anyway!
You deserve a +1!
  • 0

#103 jon sploder

jon sploder

    GMC Member

  • GMC Member
  • 858 posts

Posted 05 February 2012 - 08:17 AM

So Medo, are you going to add mac address functionality or not? I'd really not prefer having to have 39dll for just that and I'm sure many others use that function feel similarly.
  • 0

#104 Medo42

Medo42

    GMC Member

  • GMC Member
  • 220 posts

Posted 05 February 2012 - 03:57 PM

So Medo, are you going to add mac address functionality or not? I'd really not prefer having to have 39dll for just that and I'm sure many others use that function feel similarly.

This somehow dropped from my todo list before I made a new release. I'll fix that soon (probably next week). MAC address detection will be included in some form.

Edit: New version will include bit manipulation functions (bit_get, bit_set and build_ubyte), minimalistic file reading/writing support (read/write an entire file to/from a buffer) and support for querying MAC addresses. The file functions are there because I needed them for Gang Garrison 2 and keeping them in a different branch would be a pain currently because .ged files can't be merged properly. Besides, they might be useful for you as well, and waiting until I have time to start up the Shared Buffers project again isn't a good option :)

The MAC address function is the last open point now.

Edited by Medo42, 05 February 2012 - 09:36 PM.

  • 1

#105 Ronchon le Nain

Ronchon le Nain

    GMC Member

  • GMC Member
  • 87 posts
  • Version:GM8

Posted 07 February 2012 - 09:37 PM

Greetings.

While studying different alternatives of 39dll, i found this one too : http dll 2
In this one , the autor refers to an issue of 39dll :

The DLL also fixes an annoying bug/feature in 39dll that can cause data to be lost. With 39dll, the maximum amount of data that can be recieved as a whole is limited by the operating system. Windows will only buffer a fixed amount of data, e.g. 64KB. This might not be enough if you're trying to send large files. If too much data is buffered by the receiver, the sender has to wait to send more data. Since 39dll's sendmessage function doesn't wait, part of the data is lost if too much data is sent at once. This DLL does additional buffering to avoid this problem, so no data is ever lost. You can buffer as much data as you want on both the sending side and the receiving side.


Are you aware of this issue , and is it solved in Faucet Networking ?
Thanks!
  • 0

#106 Medo42

Medo42

    GMC Member

  • GMC Member
  • 220 posts

Posted 07 February 2012 - 10:19 PM

Greetings.

While studying different alternatives of 39dll, i found this one too : http dll 2
In this one , the autor refers to an issue of 39dll :


The DLL also fixes an annoying bug/feature in 39dll that can cause data to be lost. With 39dll, the maximum amount of data that can be recieved as a whole is limited by the operating system. Windows will only buffer a fixed amount of data, e.g. 64KB. This might not be enough if you're trying to send large files. If too much data is buffered by the receiver, the sender has to wait to send more data. Since 39dll's sendmessage function doesn't wait, part of the data is lost if too much data is sent at once. This DLL does additional buffering to avoid this problem, so no data is ever lost. You can buffer as much data as you want on both the sending side and the receiving side.


Are you aware of this issue , and is it solved in Faucet Networking ?
Thanks!

Yes, this is definitely something Faucet Networking solves, it was in fact one of the main problems I had with 39dll which drove me to start this project. If you send a large block of data at once, it will all be buffered and then fed to the operating system by a background thread. For a longer elaboration you can read my 39dll rant in the first post of this thread, and a comparison of the "correct" way to perform a nonblocking send in 39dll and in this extension. It is possible with 39dll, it's just very convoluted :-)
  • 0

#107 Ronchon le Nain

Ronchon le Nain

    GMC Member

  • GMC Member
  • 87 posts
  • Version:GM8

Posted 08 February 2012 - 09:34 AM

Thanks for the quick answer!
I will definitly consider changing to Faucet then :) Hope it won't be too complicated.
Keep up the good work !
  • 0

#108 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 08 February 2012 - 12:26 PM

I was about to be "herpderpderp Gang Garrison used Faucet, you should take their name!". Then I realised you wrote Gang Garrison...

I'm surprised you're still working on the game :3 It's been years since I've played it last.

Very good library though, I can't wait to test it more in depth 8D


[EDIT]
Is there a dll form of this available? I like having these types of things external from my exe's :3

Edited by orange451, 08 February 2012 - 02:17 PM.

  • 0

#109 Medo42

Medo42

    GMC Member

  • GMC Member
  • 220 posts

Posted 08 February 2012 - 08:17 PM

Is there a dll form of this available? I like having these types of things external from my exe's :3

I can include the raw dll in the upcoming update, but I won't include a source file with GML helper scripts at this time. It is worth considering that the use of GML scripts to wrap DLL calls has a considerable overhead.

As for the MAC functionality, I have done some tesing and currently have a function mac_addrs() which returns a comma-separated string with all interface addresses, or an empty string on error (or if no interfaces were found). It automatically excludes loopbacks, tunnel devices and PPP modems.

However, there may still be some interface which does not have a unique physical address, and there is no guarantee either that the addresses are always six bytes long. The function can differentiate between the interface types, but I don't feel a pressing urge to research the physical address format of over 100 different interface types.

Another itchy point is that the function is not very nice to use because Game Maker does not have a string_split function, so to get all the individual MAC addresses you have to iterate over the string like this:
var addrString, pos, mac;
addrString = mac_addrs();
pos = string_pos(",",addrString);
while(pos>0) {
    mac = string_copy(addrString, 1, pos-1);
    addrString = string_delete(addrString, 1, pos);
    show_message(mac);
    pos = string_pos(",",addrString);
}
show_message(addrString);
Since 39dll just blindly takes the first interface and assumes its hardware address to be 6 bytes long, this should give you the same output as 39dll's getmacaddress:
string_copy(mac_addrs(), 1, 17);

Any thoughts?
  • 0

#110 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 08 February 2012 - 11:06 PM

Do you have a Faucet Network logo? I can put like "Powered by Faucet Networking" or something :3
  • 0

#111 Medo42

Medo42

    GMC Member

  • GMC Member
  • 220 posts

Posted 08 February 2012 - 11:24 PM

Do you have a Faucet Network logo? I can put like "Powered by Faucet Networking" or something :3

Sean A did a logo for Rebound, but I don't have an "official" one. If you want to create one that would be awesome.
  • 0

#112 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 09 February 2012 - 12:52 PM

Another question. Does this create it's own thread to handle downloading/uploading the packets? If so, would this be a "speed" boost of sorts compared to 39dll which is limited to the room speed?
  • 0

#113 Medo42

Medo42

    GMC Member

  • GMC Member
  • 220 posts

Posted 09 February 2012 - 02:27 PM

Another question. Does this create it's own thread to handle downloading/uploading the packets? If so, would this be a "speed" boost of sorts compared to 39dll which is limited to the room speed?

Yes, this happens in a separate worker thread. In a normal network game situation this should not affect the transfer speed because you will typically send less than a kilobyte over a single socket per step. However, if you want to transfer a large ammount of data with a single nonblocking call per step, I would imagine 39dll to be slower, because the ammount you can send/receive each step is limited by the socket buffer size in the operating system. I did not test this though.

The (imo) most important reason to have the background thread is that it simplifies the interface. Without that (as it was in an early version of Faucet Net), operations that need multiple steps would have to be done in multiple calls to the library. For example, if you call tcp_connect("ganggarrison.com", 80), the library needs to make a DNS query to find the IPs for ganggarrison.com and then attempt to connect. Since the DNS query can take an unpredictable ammount of time and we don't want blocking calls, tcp_connect can only initiate the process and then return. Without a background thread, the library can't start the actual connection attempt until the game hands control back to the library by calling some function, so you need to call into the library at least twice until the connection is actually established. This is usually not a problem because you will be calling networking functions quite regularly anyway, but it makes the behavior of the library needlessly complicated to describe and understand. With a background worker thread, things you initiate will simply be done, no matter how many steps they take and how often you call into the library.

Edited by Medo42, 09 February 2012 - 02:28 PM.

  • 0

#114 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 09 February 2012 - 05:09 PM

Okay :3


And here's my poor attempt at a "faucet" icon :P

Posted Image
  • 0

#115 Medo42

Medo42

    GMC Member

  • GMC Member
  • 220 posts

Posted 09 February 2012 - 10:11 PM

Faucet Networking v1.3 is here :)

- Added new function mac_addrs() to find the physical addresses of installed networking adapters
- Added minimalistic file reading/writing support (append_file_to_buffer(), write_buffer_to_file())
- Added bit manipulation functions (bit_get(), bit_set(), build_ubyte())

Download here

You can also get the raw DLL (not sure how much use this is to anyone though)

Edited by Medo42, 09 February 2012 - 10:14 PM.

  • 1

#116 wnsrn3436

wnsrn3436

    GMC Member

  • GMC Member
  • 133 posts
  • Version:GM8

Posted 10 February 2012 - 01:55 AM

The new version is very nice.
With the addition of file-related functions, the functions of the buffer has been expanded.
Now, people will stay away from 39dll.
This is certainly feature-rich than 39dll, fast and stable.
  • 0

#117 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 10 February 2012 - 02:16 AM

Can you provide an example on (if possible) how to write and receive bits? Some of my values never exceed 7 :P
  • 0

#118 Medo42

Medo42

    GMC Member

  • GMC Member
  • 220 posts

Posted 10 February 2012 - 02:21 AM

The bit manipulation functions are documented with examples in the help.pdf. There are no functions for reading or writing individual bits from/to buffers and sockets, those only deal with bytes.
  • 0

#119 OldSkoolGamer

OldSkoolGamer

    GMC Member

  • GMC Member
  • 90 posts
  • Version:GM:Studio

Posted 12 February 2012 - 11:22 PM

Well, here's another take on the above icon for you:

Posted Image
  • 0

#120 Medo42

Medo42

    GMC Member

  • GMC Member
  • 220 posts

Posted 13 February 2012 - 12:00 AM

Well, here's another take on the above icon for you:

Posted Image

Cool, thanks to you and to orange. Yours actually has some connection to networking, but I think it's been a while since Ethernet connections actually looked like that :P
  • 0




2 user(s) are reading this topic

1 members, 1 guests, 0 anonymous users