send a small packet of data via a specific port on an ethernet interface using a batch file

I am using software that listens on serial ports and on ethernet ports for small amounts of data that it translates.
for maintenance purposes i have been periodically sending this software messages via the following syntax in a batch file

@echo on
set /p x="a017 3UNR181OPC00001" <nul >\\.\com17
EXIT

I am using 2 com ports on an 8 port "Digi Portserver" for this data to be sent to the software. however i now need these ports for another purpose, and i still need to send data periodically to the software.

is it possible to using a similar data format send my message via a specific port on my network?
perhaps somthing similar to the folowing:  

set /p x="a017 3UNR181OPC00001" <nul >\\.\eth0 127.0.0.1:1234

or

echo "a017 3UNR181OPC00001" >127.0.0.1:1234

or would i be better off virtualizing the ports using some free utility... i am looking for options that don't require an additional Digi portserver.
LVL 1
csePixelatedAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve KnightIT ConsultancyCommented:
In haven't tried it but told that nc should work.

http://www.securityfocus.com/tools/139

Using built in maybe telnet:

echo whatever | telnet x.x.x.x yy

though suspect that won't close.

Other than a VBScript should be do-able you can easily open from batch file.  If no-one jumps in will put one together later.

Steve
oBdACommented:
ncat (the successor of netcat, which is a wee bit old) should work. Download the statically compiled file from https://nmap.org/ncat/, unzip it and drop ncat.exe into the script's folder or somewhere in the path.
Then you just pipe data to it:
echo "a017 3UNR181OPC00001"| ncat.exe --send-only localhost 1234

Open in new window

telnet does not accept input over the pipeline; the only way to automate telnet would be with VBScript and sendkeys, which is error prone at best.
Examples are here: https://nmap.org/ncat/guide/ncat-usage.html

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve KnightIT ConsultancyCommented:
oBdA - nice, haven't had to do that for probably ten years which is why I thought of netcat!

Steve
csePixelatedAuthor Commented:
downloading now, reference the following link

https://nmap.org/dist/nmap-6.49BETA1-setup.exe

if i should be downloading from somewhere else please let me know, otherwise ill try it and accept working solution inside of 20hrs.
oBdACommented:
Well, that's the full nmap package; you don't need all of it, you only need the portable ncat.exe.
The link for the one you need is here (second to last paragraph before "Nmap Site Navigation"): http://nmap.org/dist/ncat-portable-5.59BETA1.zip
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.