From 65e9aba6dc57510bae1aa7e7322868592028bf82 Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 20 Nov 1999 15:39:20 +0000 Subject: [PATCH] Added support for parsing socket options. --- src/Main/fg_io.cxx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Main/fg_io.cxx b/src/Main/fg_io.cxx index dca5d3bbf..8e9f40e99 100644 --- a/src/Main/fg_io.cxx +++ b/src/Main/fg_io.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -138,14 +139,29 @@ static FGProtocol *parse_port_config( const string& config ) io->set_io_channel( ch ); } else if ( medium == "file" ) { FGFile *ch = new FGFile; + io->set_io_channel( ch ); // file name ch->set_file_name( config.substr(begin) ); FG_LOG( FG_IO, FG_INFO, " file name = " << ch->get_file_name() ); - - io->set_io_channel( ch ); } else if ( medium == "socket" ) { - // ch = new FGSocket; + FGSocket *ch = new FGSocket; + io->set_io_channel( ch ); + + // hostname + end = config.find(",", begin); + if ( end == string::npos ) { + return NULL; + } + + ch->set_hostname( config.substr(begin, end - begin) ); + begin = end + 1; + FG_LOG( FG_IO, FG_INFO, " hostname = " << ch->get_hostname() ); + + // port + ch->set_port_str( config.substr(begin) ); + FG_LOG( FG_IO, FG_INFO, " port string = " << ch->get_port_str() ); + } return io;