array tofile fromfile tosocket? fromsocket?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SpreadTooThin

    #1

    array tofile fromfile tosocket? fromsocket?

    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?

  • Thomas Jollans

    #2
    Re: array tofile fromfile tosocket? fromsocket?

    On Tue, 03 Oct 2006 10:29:00 -0700, "SpreadTooT hin" <bjobrien62@gma il.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

    Comment

    • SpreadTooThin

      #3
      Re: array tofile fromfile tosocket? fromsocket?


      Thomas Jollans wrote:
      On Tue, 03 Oct 2006 10:29:00 -0700, "SpreadTooT hin" <bjobrien62@gma il.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(dat a)
      def fromdevice(self , device):

      Is this advisable?



      --
      Thomas Jollans alias free-zombie

      Comment

      Working...