By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,551 Members | 1,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,551 IT Pros & Developers. It's quick & easy.

array tofile fromfile tosocket? fromsocket?

P: n/a
Hi I am using arrays in an application.
They have been working very well for me as I have been using them for
reading and writing data to and from files whose endianisms can be big
or little endian.
However now I need handle data that can be transferred over a socket.

I would rather not have to go in and change every occurance of tofile
and fromfile to a function but realize that is what I may have to do.
I was under the impression that a file and socket were interchangable
(like a file descriptor). Does anyone have an idea that might help me
minimize the impact on my code?

Oct 3 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, 03 Oct 2006 10:29:00 -0700, "SpreadTooThin" <bj********@gmail.com>
let this slip:
I was under the impression that a file and socket were interchangable
(like a file descriptor). Does anyone have an idea that might help me
minimize the impact on my code?
are you looking for sockets' makefile method ?

--
Thomas Jollans alias free-zombie
Oct 3 '06 #2

P: n/a

Thomas Jollans wrote:
On Tue, 03 Oct 2006 10:29:00 -0700, "SpreadTooThin" <bj********@gmail.com>
let this slip:
I was under the impression that a file and socket were interchangable
(like a file descriptor). Does anyone have an idea that might help me
minimize the impact on my code?

are you looking for sockets' makefile method ?
Yes.. but also I'm thinking about a new python class based on array...
like (psuedo code)

class myArray(array):
def todevice(self, device):
if device is a file:
self.tofile
else
writesocket(data)
def fromdevice(self, device):

Is this advisable?

--
Thomas Jollans alias free-zombie
Oct 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.