Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add port to host name #31

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions RADRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,33 @@ static TResult StartClient(unsigned short a_port)

if (g_args[ARGS_REMOTE] != nullptr)
{
if (socket.open(g_args[ARGS_REMOTE], a_port) == KErrNone)
int serverLength, portLength, port;
TLex lex(g_args[ARGS_REMOTE], static_cast<int>(strlen(g_args[ARGS_REMOTE])));

lex.SetWhitespace(":");

/* Extract the server name and port number from the remote name passed in and, if a port was specified, */
/* convert it and check its validity */
const char *serverString = lex.NextToken(&serverLength);
const char *portString = lex.NextToken(&portLength);

std::string server = std::string(serverString, serverLength);

/* The port string is optional so only parse if it is there, and use the default value if it is missing */
/* or invalid */
if (portString)
{
if (Utils::StringToInt(portString, &port) == KErrNone)
{
a_port = static_cast<unsigned short>(port);
}
else
{
Utils::Error("Specified port \"%s\" is invalid, using default port %d", portString, a_port);
}
}

if (socket.open(server.c_str(), a_port) == KErrNone)
{
try
{
Expand Down Expand Up @@ -311,7 +337,7 @@ static TResult StartClient(unsigned short a_port)
}
else
{
Utils::Error("Cannot connect to %s", g_args[ARGS_REMOTE]);
Utils::Error("Cannot connect to %s:%d", server.c_str(), a_port);
}
}
else
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,15 @@ And to use that from a remote computer:
d:\Source> RADRunner vampire PORT 68000 DIR RAM:
```

Note that when connecting to a remote computer, the port can also be specified as a part of the server name or IP
address. For instance:

```shell
d:\Source> RADRunner vampire:68000 DIR RAM:
```

In this case, the port specified as a part of the server name overrides the port specified with the PORT command.

### SCRIPT/K \<filename\>

Executes a number of commands inside the RADRunner script file specified by \<filename\>. See the section "Script Support"
Expand Down
23 changes: 17 additions & 6 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@

Regarding the release status of RADRunner, it is currently in beta. New releases
that are built by GitHub may or may not contain improvements, as the builds are
triggered automatically by code merges, so sometimes a build contains only internal
non functional changes.
This ReleaseNotes.txt was added by the author on request from a user. Until now, the author wasn't aware that the
application actually had any users!

If a build does contain a new feature or bugfix, I'll try to remember to add it to
this file with the build's release date.
Please note that RADRunner is currently in beta. Until version 1.0, binary compatibility between releases is not
guaranteed. When a new build has a binary break, it will be mentioned here. Once version 1.0 is released, it will
contain a mechanism for detecting incompatible client and server versions.

New releases that are built by GitHub may or may not contain improvements, as the builds are triggered automatically
by code merges, so sometimes a build contains only internal non functional changes.

If a build does contain a new feature or bugfix, I'll try to remember to add it to this file with the build's release
date.

Have fun with the Amiga!

Colin Ward AKA Hitman/Code HQ

Version 0.01 (2024.04.24):

- First public release

- Added ability to specify the server port as a part of the remote host name, for example localhost:8080
Loading