Pages: [1]
  Print  
Author Topic: Networking on GitHub  (Read 2216 times)
Offline (Female) IsmAvatar
Posted on: September 21, 2010, 12:27:41 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
I've uploaded my networking files to:
http://github.com/IsmAvatar/EnigmaNet

MIT license, so they can easily be relicensed to GPL.
Please feel free to contribute.

At this time, they are written in C only.
They are largely functional, but some aspects need a bit of improvement, or at least a thorough going-over - in particular, mplay_send and mplay_receive.

They are currently named mplay_ until we get a better name for them. They do not use DirectPlay (which GM uses) and we do not aim to create a reproduction of the mplay_ functionality.

They work standalone, but I'm sure they could be plugged into Enigma as well.
« Last Edit: September 21, 2010, 01:04:33 PM by IsmAvatar » Logged
Offline (Unknown gender) r9k
Reply #1 Posted on: September 21, 2010, 01:28:17 PM
Member
Joined: Aug 2010
Posts: 25

View Profile
We should build an adapter on top of EnigmaNet, while still giving access to the low level functions.

The first thing I'd like to add is a Buffer class that can grows like a vector and be written and read from like a stream.
Logged
Offline (Unknown gender) r9k
Reply #2 Posted on: September 21, 2010, 04:55:14 PM
Member
Joined: Aug 2010
Posts: 25

View Profile
It seems I'm having problems compiling on windows, I'll look into that.
Logged
Offline (Female) IsmAvatar
Reply #3 Posted on: September 21, 2010, 05:55:24 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
On windows, it has a dependency on WinSock, and you may or may not have to -l it in.
Logged
Offline (Unknown gender) TheExDeus
Reply #4 Posted on: September 25, 2010, 11:22:09 AM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
Quote
They are currently named mplay_ until we get a better name for them. They do not use DirectPlay (which GM uses) and we do not aim to create a reproduction of the mplay_ functionality.
But mplay stands for "multiplayer" as far as I know. So you might as well call them mplay_. I think Enigma should at least replicate GM functions, so creating mplay_ functions with the same parameters would be nice. GM's multiplayer wasn't the best, so no one actually used it, but still. Good work on this thou, and I like the ftp functions. The more functionality there is, the better.
Logged
Offline (Female) IsmAvatar
Reply #5 Posted on: September 25, 2010, 06:57:17 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
Reproducing those functions is more work than it's worth. I'd basically be creating my own protocol for sessions, player objects, global data objects, and message objects. Not having them is very little loss, especially considering that mplay didn't work 90% of the time for most people anyways, and everyone else switched to GmSock already. Implementing them, on the other hand, is a whole lot of work. Remember that each of those functions has a very specific purpose, so it's not like I could just hand-wave over them. I'd basically have to single-handedly recreate all the work that a large team at Microsoft/DirectX's programming division already did in directplay, and then later decided to scrap and deprecate anyways.
Logged
Offline (Unknown gender) TheExDeus
Reply #6 Posted on: September 26, 2010, 09:00:13 AM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
Ok, I agree.

Also, I didn't imply that you need to write directplay version for Enigma (so it would be as bad as GM one, and so what would be the point?). I just meant that it would be good if functions remained, like mplay_data_write(ind,val), mplay_data_read(ind) and so on. It wouldn't matter what the underlying system is. But as noone used mplay_, then I guess its better to make another system, and net_ prefix suits it.
« Last Edit: September 26, 2010, 09:06:13 AM by HaRRiKiRi » Logged
Post made September 27, 2010, 10:49:55 AM was deleted at the author's request.
Offline (Unknown gender) r9k
Reply #8 Posted on: September 27, 2010, 11:22:50 AM
Member
Joined: Aug 2010
Posts: 25

View Profile
I'm working on it.

http://github.com/r9k/EnigmaNet/

Those are the currently working functions, I tried to do them like GM functions, so it's easier for gm users to use them. Expert users will still be able to use the low level functions.

Code: [Select]
double net_tcp_connect(string ip, unsigned short port, bool blocking);
double net_tcp_connect_timeout(string ip, unsigned short port, bool blocking, float seconds);
bool net_tcp_set_blocking(double tcpsocketId, bool blocking);
double net_tcp_listen(unsigned short port, bool blocking);
double net_tcp_accept(double listener_id, bool blocking);
bool net_tcp_connected(double tcpsocketId);
bool net_tcp_disconnect(double tcpsocketId);
bool net_tcp_send(double tcpsocketId, double packetId);
bool net_tcp_receive(double tcpsocketId, double packetId);
bool net_tcp_destroy(double tcpsocketId);


bool net_udp_bind(unsigned short port, bool blocking);
bool net_udp_bind_available(bool blocking);
bool net_udp_unbind(double udpsocketId);
unsigned short net_udp_localport(double udpsocketId);
bool net_udp_set_blocking(double udpsocketId, bool blocking);
bool net_udp_send(double udpsocketId, double packetId, string ipAddress, unsigned short remotePort);
bool net_udp_receive(double udpsocketId, double packetId, string &ipAddress, unsigned short &remotePort);
bool net_udp_destroy(double udpsocketId);

double net_http_create();
bool net_http_host(double httpId, string host);
double net_http_send(double httpId, double httpRequestId);
bool net_http_destroy(double httpId);
double net_http_request_create();
bool net_http_request_method(double httpRequestId, string method);
bool net_http_request_uri(double httpRequestId, string uri);
bool net_http_request_field(double httpRequestId, string name, string value);
bool net_http_request_body(double httpRequestId, string body);
bool net_http_request_destroy(double httpRequestId);
double net_http_response_status(double httpResponseId);
string net_http_response_body(double httpResponseId);
bool net_http_response_destroy(double httpResponseId);

string net_last_error();

double net_packet_create();
bool net_packet_destroy(double packetId);
template <class T> bool net_packet_write(double packetId, T value);
template <class T> bool net_packet_read(double packetId, T &var);
bool net_packet_clear(double packetId);
double net_packet_size(double packetId);

double net_utility_rc4_create(string keyString);
bool net_utility_rc4_step(double rc4Id);
bool net_utility_rc4_step_add(double rc4Id, double step);
bool net_utility_rc4_step_set(double rc4Id, double step);
char net_utility_rc4_byte(double rc4Id);
bool net_utility_rc4_xor(double rc4Id, double packetId);
bool net_utility_rc4_destroy(double rc4Id);
« Last Edit: September 27, 2010, 11:24:28 AM by r9k » Logged
Pages: [1]
  Print