Passing parameters to an executable vs. passing them to a server

R

Ramon F Herrera

The only method that I have ever used to pass parameters to a program
is the good 'ole trusted:

main(int argc, char *argv[])

As of late, however, I began writing servers (more like "borrowing"
their code from the net :), and I am not familiar with the method
used to pass arguments to them.

The specific server program that I modified is this one:

http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tutdaytime2/src.html

It is a "daytime" server, which does not accept any arguments.

TIA,

-Ramon
 
R

Ramon F Herrera

The only method that I have ever used to pass parameters to a program
is the good 'ole trusted:

main(int argc, char *argv[])

As of late, however, I began writing servers (more like "borrowing"
their code from the net :), and I am not familiar with the method
used to pass arguments to them.

The specific server program that I modified is this one:

http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tut...

It is a "daytime" server, which does not accept any arguments.

TIA,

-Ramon

Never mind!!!

-Ramon
 
R

Ramon F Herrera

Ramon F Herrera wrote:

Please restrict your cross-posting!

Ian,

I don't mean to be rude, but...

Google News allows 5 newsgroups.

The creators of Usenet designed the ability to cross-post.

Take your issue with them.

The 3 newsgroup I posted to are pertinent.

What are your trying to save? Disk space?

Have you noticed the spam crap that Usenet has become?

Every time a legitimate article (like mine) is posted, it scrolls down
the spam.

-Ramon
 
R

Ramon F Herrera

The only method that I have ever used to pass parameters to a program
is the good 'ole trusted:

main(int argc, char *argv[])

As of late, however, I began writing servers (more like "borrowing"
their code from the net :), and I am not familiar with the method
used to pass arguments to them.

The specific server program that I modified is this one:

http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tut...

It is a "daytime" server, which does not accept any arguments.

TIA,

-Ramon


I was looking at this echo server:

http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/example/echo/blocking_tcp_echo_client.cpp

and it looks like it is up to the coder to package the arguments on
the clients and break them down in the server?

Perhaps I need to construct the arguments like this?:

string arguments = "arg1 = this; arg2 = that; arg3 = whatever";

TIA,

-Ramon
 
I

Ian Collins

Ramon said:
Ian,

I don't mean to be rude, but...

Google News allows 5 newsgroups.

The creators of Usenet designed the ability to cross-post.

Take your issue with them.

The 3 newsgroup I posted to are pertinent.

If you have a C++ language question, use c.l.c++, a Unix specific one,
c.l.p and use c.p for non-specific programming questions. This one
looks like a C++ question.
Have you noticed the spam crap that Usenet has become?

No, I use a decent server and client.
 
I

Ian Collins

Ramon said:
The only method that I have ever used to pass parameters to a program
is the good 'ole trusted:

main(int argc, char *argv[])

As of late, however, I began writing servers (more like "borrowing"
their code from the net :), and I am not familiar with the method
used to pass arguments to them.

The specific server program that I modified is this one:

http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tut...

It is a "daytime" server, which does not accept any arguments.

TIA,

-Ramon


I was looking at this echo server:

http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/example/echo/blocking_tcp_echo_client.cpp

and it looks like it is up to the coder to package the arguments on
the clients and break them down in the server?

Eh? it uses argv[n] just like any other C++ application.
 
R

Ramon F Herrera

Ramon said:
The only method that I have ever used to pass parameters to a program
is the good 'ole trusted:
main(int argc, char *argv[])
As of late, however, I began writing servers (more like "borrowing"
their code from the net :), and I am not familiar with the method
used to pass arguments to them.
The specific server program that I modified is this one:
http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tut....
It is a "daytime" server, which does not accept any arguments.
TIA,
-Ramon
I was looking at this echo server:

and it looks like it is up to the coder to package the arguments on
the clients and break them down in the server?

Eh?  it uses argv[n] just like any other C++ application.


Thanks, Ian.

I got confused about for a little while.

The problem is that a server has to receive arguments twice:

(1) When it first starts up, in the classical way (argv[]).

(2) When it is running, it gets connections from clients which need
to pass to it a different set of parameters.

The part that I am investigating is the second.

I am currently reading the code of this http client. See snippet
below.

http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/example/http/client/sync_client.cpp

Thx,

-Ramon

----------------------

// Form the request. We specify the "Connection: close" header so
that the
// server will close the socket after transmitting the response.
This will
// allow us to treat all data up until the EOF as the content.
boost::asio::streambuf request;
std::eek:stream request_stream(&request);
request_stream << "GET " << argv[2] << " HTTP/1.0\r\n";
request_stream << "Host: " << argv[1] << "\r\n";
request_stream << "Accept: */*\r\n";
request_stream << "Connection: close\r\n\r\n";

// Send the request.
boost::asio::write(socket, request);
 
P

Pascal J. Bourguignon

Ramon F Herrera said:
__________________________________________________________________________________________^^^^^^



You are inconsistent. How do you expect us to answer meaningfully
inconsistent questions?

and it looks like it is up to the coder to package the arguments on
the clients and break them down in the server?

What are you talking about?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top