declaration problem
Steve Holden
steve at holdenweb.com
Fri Nov 7 11:51:32 EST 2008
Marc 'BlackJack' Rintsch wrote:
> On Fri, 07 Nov 2008 16:05:22 +0530, devi thapa wrote:
>
>> I am using the command
>>
>> recv(..) to receive a message from client.
>>
>> retval = recv(my_socket, *buf, len(buf) , 0)
>>
>> and its giving this error
>>
>> File "./server1.py", line 31
>> retval = recv(my_socket, *buf, len(buf) , 0)
>> ^
>> SyntaxError: invalid syntax
>
> ``*buf`` means "unpack everything in `buf` as if it where written as
> positional arguments". It is not some "pointer dereferencing" syntax, as
> Python doesn't have pointers as data types. After argument unpacking it
> is not allowed to have other positional arguments. That's the syntax
> error.
>
>>From where do you get `recv()` anyway? And what is `my_socket`? Most
> certainly not an instance created with `socket.socket` because then you
> would use the `recv()` method of that object.
>
It's C, loosely transcribed as pseudo-Python. For some clues about
networking, take a look at
http://holdenweb.com/docs/NetProg.pdf
but this does assume you want to learn Python, not carry on writing C.
[Jack, the above is address to Devi, not you].
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list