LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Linux equivalent of COM? (https://www.linuxquestions.org/questions/programming-9/linux-equivalent-of-com-726006/)

mrtedweb 05-14-2009 11:59 AM

Linux equivalent of COM?
 
Hello everyone,

I'm new to Linux and wonder if there's an equivalent to Windows COM? I have two applications that need to talk to each other across a network. I have no idea where to begin and really hope somebody can answer my question.

Thanks!

Sergei Steshenko 05-14-2009 12:57 PM

Quote:

Originally Posted by mrtedweb (Post 3540819)
Hello everyone,

I'm new to Linux and wonder if there's an equivalent to Windows COM? I have two applications that need to talk to each other across a network. I have no idea where to begin and really hope somebody can answer my question.

Thanks!

You need to learn (about) socket programming. Really just a few lines in, for example, Perl (like 10 or so lines for client/server).

Will be more in "C".

Roughly, very similar to files when sockets are created/connected to.

hitchhik 05-14-2009 02:38 PM

Nework programming library in C++
 
Quote:

Originally Posted by mrtedweb (Post 3540819)
Hello everyone,

I'm new to Linux and wonder if there's an equivalent to Windows COM? I have two applications that need to talk to each other across a network. I have no idea where to begin and really hope somebody can answer my question.

Thanks!

It might not be a COM equivalent, but you can look into the wvstreams library at http://alumnit.ca/wiki/?WvStream if you want to do some C++ development and don't want to rewrite everything from scratch.

...hh

DCOH 05-14-2009 10:26 PM

The com ports in linux start with ttyS0 and go on from there the next one would be ttyS1.

hitchhik 05-15-2009 08:14 AM

Quote:

Originally Posted by DCOH (Post 3541321)
The com ports in linux start with ttyS0 and go on from there the next one would be ttyS1.

:D

Just in case this wasn't a joke - I do believe the original poster referred to the MS Component Object Model (COM). http://www.microsoft.com/com/default.mspx

mrtedweb 05-15-2009 09:30 AM

Thanks to everyone for your help!

I finally realized I need socket programming (thanks to Sergei Steshenko). My client is looking for a magic bullet that will reduce their current costs as well as help with maintenance issues. Obviously my first thought was Linux (I'm starting with Ubuntu). I'm needing a little push to get me started as the current application was built with Visual Basic (ugh).

schneidz 05-15-2009 10:39 AM

netcat is good for quick-and-dirty data transfer within a network.

man netcat
__________________

i am confused by how com plays into this. microsoft command object modules are atiquated self-contained dos executables replaced by windows pe (portable executable) *.exe's.

linux uses elf (executable and linking format).

__________________

oh wait you are talking about com port (usually refered to as a serial port) ?

Quote:

The serial ports are named ttyS0, ttyS1, etc. (and usually correspond respectively to COM1, COM2, etc. in DOS/Windows). The /dev directory has a special file for each port. Type "ls /dev/ttyS*" to see them. Just because there may be (for example) a ttyS3 file, doesn't necessarily mean that there exists a physical serial port there.
i presumed you meant you are connecting via an ethernet network.
__________________

this is also duplicated in the newbies forum...

__________________

what does the program do ?

can you explain what you are trying to accomplish ? i assume there are a few ways to impliment it in linux... i have no idea of what 'windows com' you speak of and i have no idea of what it actually does ?

Sergei Steshenko 05-15-2009 10:45 AM

Quote:

Originally Posted by mrtedweb (Post 3541846)
Thanks to everyone for your help!

I finally realized I need socket programming (thanks to Sergei Steshenko). My client is looking for a magic bullet that will reduce their current costs as well as help with maintenance issues. Obviously my first thought was Linux (I'm starting with Ubuntu). I'm needing a little push to get me started as the current application was built with Visual Basic (ugh).

I can find a sockets tutorial in Perl - aren't you tempted to have something up and running after writing like ~20 lines of code altogether ?

...

Anyway, I think you may also need to learn what 'fork' and 'socketpair' are, and maybe also what 'exec' is.

rriggs 05-15-2009 12:00 PM

I assume you mean DCOM (Distributed COM) and not COM. Linux does not have a DCOM equivalent that is part of the base OS. That's because DCOM is OS-specific and in the Linux/Unix world, interoperability is king. There are numerous options, depending on the language you wish to use and the complexity of the network communications. You can use things as complicated as SOAP or CORBA for this, to message queues (http://fedoraproject.org/wiki/Featur...Infrastructure), to xmlrpc, all the way down to netcat, rsh or direct socket connections.

You haven't told us what language you may be using. That will determine what options you have. Not every technology has a decent language binding.

If you are doing professional work, consider using a technology that provides for a little more resiliency such as message queues. This can allow you to focus on the high-level stuff rather than getting bogged down in low-level socket stuff.

schneidz 05-15-2009 12:01 PM

Quote:

Originally Posted by Sergei Steshenko (Post 3541948)
...

Anyway, I think you may also need to learn what 'fork' and 'socketpair' are, and maybe also what 'exec' is.

i remember in 'operating system design' class that the windows equivelent of fork() then exec() -- (or i always cheated and used system()) is NTCreateProcess(...).

do they now wrap it in something called com ?

Sergei Steshenko 05-15-2009 12:09 PM

Quote:

Originally Posted by schneidz (Post 3542008)
i remember in 'operating system design' class that the windows equivelent of fork() then exec() -- (or i always cheated and used system()) is NTCreateProcess(...).

do they now wrap it in something called com ?

No, AFAIK they (UNIXes) do not wrap it in something called 'com'.

I also very much prefer 'system', especially in Perl, but if one really wants IPC (i.e. processes talk to each other) then fork (with its file handles duplication) and exec are the way to go.

OTOH, if one just wants to start another process an wait for its completion, then 'system' is apparently the simplest way to do it.

...

Anyway, if you use sockets, since one can use explicit port number, the processes can talk to each other not being forked in father -> child manner.

schneidz 05-15-2009 12:12 PM

Quote:

Originally Posted by Sergei Steshenko (Post 3542015)
No, AFAIK they (UNIXes) do not wrap it in something called 'com'.

i was asking if NTCreateProcess() is now defunct in favor of something like com() ?

i still dont know what com is ? (a few post above i mistook it for dos executables or serial port).

Sergei Steshenko 05-15-2009 12:21 PM

Quote:

Originally Posted by schneidz (Post 3542019)
Quote:

Originally Posted by Sergei Steshenko (Post 3542015)
No, AFAIK they (UNIXes) do not wrap it in something called 'com'.

i was asking if NTCreatProcess() is now defunct in favor of something like com() ?

i still dont know what com is ? (a few post above i mistook it for dos executables and serial port).

I can't answer your question - I only recently started porting my stuff to Windows, and I'm doing it in cross-platform manner, so I'm not enough familiar with NT stuff.

...

COM, AFAIK, is Common Object Model.

ghostdog74 05-15-2009 07:51 PM

Quote:

Originally Posted by mrtedweb (Post 3541846)
Thanks to everyone for your help!

I finally realized I need socket programming (thanks to Sergei Steshenko). My client is looking for a magic bullet that will reduce their current costs as well as help with maintenance issues. Obviously my first thought was Linux (I'm starting with Ubuntu). I'm needing a little push to get me started as the current application was built with Visual Basic (ugh).

you can also look at Python's socket programming.

mrtedweb 05-18-2009 10:14 AM

Until now, I have only programmed in Windows (with the exception of web development). I have always used Microsoft's Component Object Model to have separate applications communicate with eachother (DLL Hell). Linux is a whole new world to me and I'm obviously at the "bewilderment" stage. Thanks to everyone for their response to this thread. It has amazed and encouraged me.

I'm designing a basic client/server POS application. Several terminals will need to access the server simultaneously across a local network. I thought about using Windows COM, but I'm unsure of how to implement that across a network. I toyed with the idea of using SOAP, but my experience with SOAP required a web server. Not neccessary/desirable since it will be on a local network and we're trying to simplify things. It appears that sockets are the best way to go and Linux could possibly provide for a simple yet stable environment. Am I being naive to think that?

My biggest question now is which flavor of Linux to use. I imagine the only way to answer this question is by experimenting. Are there any problems porting an application from one version of Linux to another? Since the team is familiar with .NET, it seems best to use Mono's C#.


All times are GMT -5. The time now is 08:43 AM.