Access AMIP socket server from *nix |
Access AMIP socket server from *nix |
uplate |
Oct 10 2007, 02:03 AM
Post
#1
|
Member Group: Members Posts: 21 Joined: 10-October 07 Member No.: 391 |
Hi, I am interested in trying to access AMIP from *nix. It appears that AMIP server creates a TCP socket connection that should be able to be accessed remotely. Can you give some indication on how this could be done?
I've tried with socket and telnet, but both indicate that the AMIP hosting machine refuses the connection. My setup: [WIN] AMIP Server:40581 [NIX] Client access: `telnet WIN 40581` `socket WIN 40581` Thanks |
uplate |
Nov 4 2007, 05:24 PM
Post
#2
|
Member Group: Members Posts: 21 Joined: 10-October 07 Member No.: 391 |
Implemented ClientService mechanism as an irssi plugin. BOOST_THREADS don't seem to play nicely in irssi, I get failure to allocate thread resources. So I'm forced to use POSIX threads (pthreads), which, while probably not as safe, is definitely doable since I'm only using a single thread for the service. I basically copied your GenericServer word for word, replacing the windows thread stuff with unix thread stuff. I think I basically have it down, although I don't really understand a few things.
(1) Mutexes. No idea what these are, I'll have to read up. (2) The mechanism through which a C++ member function is passed as a function pointer argument to a C function. Regarding (2), I was pulling my hair out trying to figure out how to do this, when I decided to try it like you did. I figured your method wouldn't work on *nix, thinking it was MS specific, but it worked great. You are a genius sir . Here are the salient features of my implementation. CODE extern "C" { #include <pthread.h> void *thread_start(void *); } template<typename InterfaceT, typename ImplementationT> class NarcService { public: NarcService() { ... } void start() { pthread_create( &serverThread, NULL, thread_start, this ); } private: void joinServerThread() { pthread_join(serverThread,NULL); } virtual void run() { server->startInThisThread(boost::bind( &NarcService::joinServerThread,this)); } static void *thread_start( void *obj ) { (static_cast<NarcService *>(obj))->run(); } }; Attached thumbnail(s) |