>>
>>So what if the client sends 4 bytes, and then sends 8000 bytes? WIll I
>>get the first 4 bytes as a separate msg so to speak? Basically i want
>>to catch each message from the client as a whole.
>>
IF YOU WANT SEPARATE MESSAGES:
Modify the client to send an end of record, then:
On Server:
phil wrote:
>>
>> By the way, what is 'rb' and 'wb' ?
>>
>
> Read Binary, Write Binary
> In Win32 the default is text mode which
> will screw up binary files
>
In fact, this is not just for Windows. Linux / Unix is unusual
using the originally non-standards-conforming line feed ('\n')
character
codecraig wrote:
> so something like,
>
> x = sock.recv(1024)
> while (len(x) > 0):
> # do stuff
> x = sock.recv(1024)
>
>
> ??
>
> So what if the client sends 4 bytes, and then sends 8000 bytes? WIll I
> get the first 4 bytes as a separate msg so to speak? Basically i want
> to catch
so something like,
x = sock.recv(1024)
while (len(x) > 0):
# do stuff
x = sock.recv(1024)
??
So what if the client sends 4 bytes, and then sends 8000 bytes? WIll I
get the first 4 bytes as a separate msg so to speak? Basically i want
to catch each message from the client as a whole.
>
> By the way, what is 'rb' and 'wb' ?
>
Read Binary, Write Binary
In Win32 the default is text mode which
will screw up binary files
> Also, when I create a client/server sockets I do something like...
>
> SERVER
> ---
> server.bind(('', 4321))
> (sock, addr) = server.accept()
> x =
well on the server, if I have,
x = sock.recv(1024) and the client sends more than 1024 bytes...the
server won't receive it all right? So I am wondering, how do I setup
the server to handle some unknown amount of data?
Note, in previous post it should have been, x = sock.recv(1024) not x =
se
codecraig wrote:
> I have a image file on my pc, say a .jpg. Basically I want to setup a
> client/server socket, and I want the client to read in the jpg and send
> it to the server, where the server can write that data into a new file
> on the server.
>
> I tried just doing something like..
>
By the way, what is 'rb' and 'wb' ?
Also, when I create a client/server sockets I do something like...
SERVER
---
server.bind(('', 4321))
(sock, addr) = server.accept()
x = server.recv(1024)
CLIENT
client.connect(('localhost', 4321))
x = open("abc.txt", "rb")
client.send(x)
thanks Phil, the problem was that I was not using "rb" and "wb".
thanks.
--
http://mail.python.org/mailman/listinfo/python-list
codecraig wrote:
> I have a image file on my pc, say a .jpg. Basically I want to setup a
> client/server socket, and I want the client to read in the jpg and send
> it to the server, where the server can write that data into a new file
> on the server.
>
> I tried just doing something like..
>
>
> I have a image file on my pc, say a .jpg. Basically I want to setup a
> client/server socket, and I want the client to read in the jpg and send
> it to the server, where the server can write that data into a new file
> on the server.
>
> I tried just doing something like..
>
> x = open("abc.
I have a image file on my pc, say a .jpg. Basically I want to setup a
client/server socket, and I want the client to read in the jpg and send
it to the server, where the server can write that data into a new file
on the server.
I tried just doing something like..
x = open("abc.jpg")
y = x.read()
12 matches
Mail list logo