0

In Linux, it is possible to send and receive network messages using the /dev/tcp device file. This is useful for example, when there is a need to download a file or send a message to a remote host from a very basic Linux installation (no Telnet, no SSH, no browser etc.)

I'm looking for an equivalent in Windows. I know that using Telnet, Netcat or even Powershell are some possibilities to connect to remote servers. However, I'm looking for a solution which works without needing to install and/or download something and without Telnet and Powershell (as those are not necessarily installed on available, depending on the Windows version and the current user's rights).

Is it possible to send and receive network messages in Windows without using Telnet or Powershell and without using external programs? If yes, how?

1

Linux does not have /dev/tcp. That path is emulated entirely within Bash – notice that it only works for redirections but not as a standalone path argument.

So if you can rely on having the Bash shell on Linux (which doesn't come with all distros), you can likewise rely on having PowerShell on Windows (which does come with all modern Windows systems).

That said, before PowerShell scripts, there was Windows Scripting Host which could run JScript and VBScript (and optionally Perl) with access to COM/ActiveX objects. Although it does not have the ability to use raw sockets, it does have the ability to make HTTP requests, as demonstrated on StackOverflow:

Dim objHTTP
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.open "GET", "https://stackoverflow.com/a/6840598", false
objHTTP.send 
WScript.Echo objHTTP.responseText

(This is actually the origin of XMLHttpRequest in web JavaScript, so the API will seem similar.)

WSH with VBScript is still part of every Windows system, as it drives quite a few standard tools (e.g. the Windows Activation license management tool slmgr.vbs).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.