Effectively what I need to do is to set up Unix sockets (server and client) for a serial port (as provided by a USB-to-Serial adapter). This socket would then be used to communitate with a Windows XP app running under a Parallels VM. True the hardware resource could be bound directly to the VM, but this doesn't work very well (to slow). It is my hope that, by keeping the hardware resource on the Mac side of the equation and having OSX take care of buffering and flow control, that it will eliminate the data loss I am seeing now. No problem setting up the sockets on the VM side, but I have no idea what needs to be done on the OSX side.
(Yes, I know that even the way I present this problem is probably flawed since I know very little about this whole area. Please be patient.)
20" Intel iMac (2.0GB RAM, 500GB HD + 1.5TB external, 20" Cineama Display),
Mac OS X (10.4.7),
All tools, no talent!
well, I don't know if what you're trying to do will work. though it would be neat if it does.
To set up a unix socket, see the unix(4) manpage.
if you scratch out a program that accesses the network it should be to hard. It should also be possible to do this using perl.
perldoc -f socket
socket SOCKET,DOMAIN,TYPE,PROTOCOL
Opens a socket of the specified kind and attaches it to file-
handle SOCKET. DOMAIN, TYPE, and PROTOCOL are specified the
same as for the system call of the same name. You should "use
Socket" first to get the proper definitions imported. See the
examples in "Sockets: Client/Server Communication" in perlipc.
On systems that support a close-on-exec flag on files, the flag
will be set for the newly opened file descriptor, as determined
by the value of $^F. See "$^F" in perlvar.
It's been a long time since I've done any programming (when I started, computers were made with vacuum tubes and we programmed them with patchcords). I went back and took a look at the Windows app that I need to share a socket with. The only option is to allow you to set the socket name (the example they give is '/tmp/serial') and you do this for both client and server sockets.
Anyway, can you recommend a free universal Perl interpreter and/or compiler? You make a references 'To set up a unix socket, see the unix(4) manpage'. Could you elaborate?
For perl, open the Terminal.app which is in the Utilities Folder that located in the Applications Folder. OS X comes with perl, all that is needed is a good book on how to program perl. Every one has there preferences, I liked this one the best
Probably too much to hope for, but does something like this come in compiled form where you fill in a few blanks and it does what needs to be done? I'm afraid I'm getting in way over my head on this one.
So happens I have a couple Perl books in my library: 'Mastering Perl 5' and 'Cross-Platform Perl'. Time to start reading I guess. Do you by any chance know where I might find applicable source code I could study? Again, my basic task is to make the Mac serial ports available to the VM. There are provisions in the VM for setting up client and server sockets, and I guess they do the rest on their side for you. I just need to write a hopefully simple routine that makes the Mac's SIO ports available to an external process (the VM in this case).
Hmmm...it would appear what I am looking for is a 'serial port redirector'. I found many shareware programs in the Windows world that will do this, but noting in the Mac world. Well at least now I have a name for what I am trying to do.
If you are getting in over your head, may as well go head-first!
I think you can do what you want using
Netcat. You can download the source and compile it yourself using Apple's Xcode development tools. Or, you can download a precompiled version from darwinports or fink.
Then, do something similar to the
instructions here. Your serial device
may be something like
/dev/**.usbserial0. I have a hard time keeping serial port straight on *nix systems.
Thank you for the information. There might be light at the end of the tunnel after all. I looked at the example you provided and understand the basics. Now I have to figure how to convert that to interprocess communication using sockets.
While I haven't quite gotten this to work, I'm pretty sure this is the best approach. I just wanted to make sure I gave the appropriate credit while fresh in my mind.
This thread has been closed by the system or the community team.
You may vote for any posts you find helpful, or search the Community for additional answers.
Setting up a socket
Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.