Re: Read / Write image file REC SEP

2005-05-04 Thread phil
>> >>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:

Re: Read / Write image file

2005-05-04 Thread Scott David Daniels
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

Re: Read / Write image file

2005-05-04 Thread Peter Hansen
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

Re: Read / Write image file

2005-05-04 Thread codecraig
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.

Re: Read / Write image file

2005-05-03 Thread phil
> > 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 =

Re: Read / Write image file

2005-05-03 Thread codecraig
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

Re: Read / Write image file

2005-05-03 Thread Maciej Dziardziel
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.. >

Re: Read / Write image file

2005-05-03 Thread codecraig
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)

Re: Read / Write image file

2005-05-03 Thread codecraig
thanks Phil, the problem was that I was not using "rb" and "wb". thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Read / Write image file

2005-05-03 Thread Max M
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.. > >

Read / Write image file

2005-05-03 Thread phil
> 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.

Read / Write image file

2005-05-03 Thread codecraig
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()