Skip to content

Commit

Permalink
Introduce the network module prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
cpurdy committed Apr 9, 2022
1 parent 3dcb6fb commit 2fa6c50
Show file tree
Hide file tree
Showing 10 changed files with 743 additions and 3 deletions.
22 changes: 22 additions & 0 deletions lib_net/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Networking Library

Folder: `./lib_net/`

Status: Prototype, in review stage

* This directory contains the Ecstasy code for the standard `net.xtclang.org` module.
* This is not part of the build yet, and is unlikely to compile without the various
minor edits that one would expect to have to perform to get new code to compile.
* This library is intended to serve the `web.xtclang.org` module (and anything else that
needs network communication), but the web module is still undergoing significant
refactoring.

Example code:

// the basic idea is that, for the most part, it will be possible to rely on the
// network implementations to be injected
@Inject Network network;
@Inject Network secureNetwork; // for SSL/TLS connections

assert ServerSocket listenerHTTP := network.listen((IPv6Any, 80));
assert ServerSocket listenerHTTPS := secureNetwork.listen((IPv6Any, 443));
15 changes: 15 additions & 0 deletions lib_net/src/main/x/net.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* The Ecstasy standard module for basic networking support.
*/
module net.xtclang.org
{
/**
*
*/
typedef Tuple<String|IPAddress, UInt16> as HostPort;

/**
*
*/
typedef Tuple<IPAddress, UInt16> as SocketAddress;
}
Loading

0 comments on commit 2fa6c50

Please sign in to comment.