Skip to content

Commit

Permalink
client connect via 127.0.0.1 rather than *
Browse files Browse the repository at this point in the history
  • Loading branch information
bombela committed Sep 23, 2012
1 parent e7a9c6a commit 4bbe475
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ Call the server from the command-line


Now, in another terminal, call the exposed module:: Now, in another terminal, call the exposed module::


$ zerorpc --client --connect tcp://*:1234 strftime %Y/%m/%d $ zerorpc --client --connect tcp://127.0.0.1:1234 strftime %Y/%m/%d
Connecting to "tcp://*:1234" Connecting to "tcp://127.0.0.1:1234"
"2011/03/07" "2011/03/07"


Since the client usecase is the most common one, "--client" is the default Since the client usecase is the most common one, "--client" is the default
parameter, and you can remove it safely:: parameter, and you can remove it safely::


$ zerorpc --connect tcp://*:1234 strftime %Y/%m/%d $ zerorpc --connect tcp://127.0.0.1:1234 strftime %Y/%m/%d
Connecting to "tcp://*:1234" Connecting to "tcp://127.0.0.1:1234"
"2011/03/07" "2011/03/07"


Moreover, since the most common usecase is to *connect* (as opposed to *bind*) Moreover, since the most common usecase is to *connect* (as opposed to *bind*)
you can also omit "--connect":: you can also omit "--connect"::


$ zerorpc tcp://*:1234 strftime %Y/%m/%d $ zerorpc tcp://127.0.0.1:1234 strftime %Y/%m/%d
Connecting to "tcp://*:1234" Connecting to "tcp://127.0.0.1:1234"
"2011/03/07" "2011/03/07"




Expand All @@ -63,8 +63,8 @@ See remote service documentation
You can introspect the remote service; it happens automatically if you don't You can introspect the remote service; it happens automatically if you don't
specify the name of the function you want to call:: specify the name of the function you want to call::


$ zerorpc tcp://*:1234 $ zerorpc tcp://127.0.0.1:1234
Connecting to "tcp://*:1234" Connecting to "tcp://127.0.0.1:1234"
tzset tzset(zone) tzset tzset(zone)
ctime ctime(seconds) -> string ctime ctime(seconds) -> string
clock clock() -> floating point number clock clock() -> floating point number
Expand All @@ -85,17 +85,17 @@ Specifying non-string arguments
Now, see what happens if we try to call a function expecting a non-string Now, see what happens if we try to call a function expecting a non-string
argument:: argument::


$ zerorpc tcp://*:1234 sleep 3 $ zerorpc tcp://127.0.0.1:1234 sleep 3
Connecting to "tcp://*:1234" Connecting to "tcp://127.0.0.1:1234"
Traceback (most recent call last): Traceback (most recent call last):
[...] [...]
TypeError: a float is required TypeError: a float is required


That's because all command-line arguments are handled as strings. Don't worry, That's because all command-line arguments are handled as strings. Don't worry,
we can specify any kind of argument using JSON encoding:: we can specify any kind of argument using JSON encoding::


$ zerorpc --json tcp://*:1234 sleep 3 $ zerorpc --json tcp://127.0.0.1:1234 sleep 3
Connecting to "tcp://*:1234" Connecting to "tcp://127.0.0.1:1234"
[wait for 3 seconds...] [wait for 3 seconds...]
null null


Expand Down

0 comments on commit 4bbe475

Please sign in to comment.