×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    57

    sending Image throw socket

    Dear friend
    Can any one help me by telling me how can I send an image object throw a TCP SOCKET?

    In the video record example; in the function finder_cb(im): we can get im object which represent the frame. I need to send this object to TCP/ IP server.

  2. #2
    Regular Contributor
    Join Date
    Dec 2007
    Location
    India
    Posts
    133

    Re: sending Image throw socket

    Do you mean to upload the image to a server?

    You can use PHP scripting language with a python script running on the mobile whcih uploads as a client. Check the exercise here
    Kandyfloss

    V 7.0642.0
    18-10-06
    RH-51
    Nokia 7610

  3. #3
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    57

    Unhappy Re: sending Image throw socket

    Thanks sir for your replay and sorry if my description not clear.
    Which I am looking for it is to make the PyS60 client capturing images and send it throw socket to Server run on PC. This application will be like the Symbian Web came.
    Code:
    import socket
    import camera
    from graphics import *
    from appuifw import *
    photo=Image.new((100,100))
    photo.clear(0)
    photo=Image.open('c:\\a.jpg')
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect(("192.168.9.100", 9090))
    out = sock.makefile("rw", 0)
    print >> out, photo
    out.close()
    print "Client ok"
    and when I use this example in the save I get this message in the receiving object
    Code:
    <graphics.Image object at 0x25030d90>

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: sending Image throw socket

    Quote Originally Posted by msalamah82 View Post
    Thanks sir for your replay and sorry if my description not clear.
    Which I am looking for it is to make the PyS60 client capturing images and send it throw socket to Server run on PC. This application will be like the Symbian Web came.
    Code:
    import socket
    import camera
    from graphics import *
    from appuifw import *
    photo=Image.new((100,100))
    photo.clear(0)
    photo=Image.open('c:\\a.jpg')
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect(("192.168.9.100", 9090))
    out = sock.makefile("rw", 0)
    print >> out, photo
    out.close()
    print "Client ok"
    and when I use this example in the save I get this message in the receiving object
    hi msalamah82
    ur code seems to be correct can i ask u a question u r talking abt which video recording example

  5. #5
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    57

    Red face Re: sending Image throw socket

    Dear gaba88
    This example is work with the python but not with pyS60.
    The servers which run on the PC get a text message.
    And I found a solution:
    Code:
    import socket
    import camera
    from graphics import *
    from appuifw import *
    fh = file('c:\\e.bmp', 'rb');
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect(("192.168.9.100", 9090))
    sock.send(fh.read())
    fh.close()
    print "Client ok"
    But in this code you can see that the PyS60 client must to save the image and read it then send it. And in the server, the server must read the incoming data and save it on file and then red it as reading image from the disk.

    If any one can help me and show me how to send image as "Image Object".
    This will make my application faster.

  6. #6
    Regular Contributor
    Join Date
    Dec 2007
    Location
    India
    Posts
    133

    Re: sending Image throw socket

    Quote Originally Posted by msalamah82 View Post
    Dear gaba88
    This example is work with the python but not with pyS60.
    The servers which run on the PC get a text message.
    And I found a solution:
    Code:
    import socket
    import camera
    from graphics import *
    from appuifw import *
    fh = file('c:\\e.bmp', 'rb');
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect(("192.168.9.100", 9090))
    sock.send(fh.read())
    fh.close()
    print "Client ok"
    But in this code you can see that the PyS60 client must to save the image and read it then send it. And in the server, the server must read the incoming data and save it on file and then red it as reading image from the disk.

    If any one can help me and show me how to send image as "Image Object".
    This will make my application faster.
    Have you tried

    Code:
    conn = httplib.HTTPConnection("Server")
    rather than the socket.
    This is what I prefer as I pointed in the above mentioned link.
    Kandyfloss

    V 7.0642.0
    18-10-06
    RH-51
    Nokia 7610

  7. #7
    Registered User
    Join Date
    Mar 2008
    Posts
    2

    Re: sending Image throw socket

    I'm also looking for this,
    basically I want the binary representation of the Image without having to save it as a file first.

    Any solution for this?

  8. #8
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    57

    Exclamation Re: sending Image throw socket

    Dear friends
    Just I like to know if the new virgin of pyS60 1.4.3 can send image throw socket without save the image on file and send it as file format

  9. #9
    Registered User
    Join Date
    Jul 2007
    Posts
    18

    Re: sending Image throw socket

    Friend

    What you want to do is called serialization (or marshalling).
    http://en.wikipedia.org/wiki/Serialization

    I'm not sure how an image object is represented internally in PyS60, its probably a good idea to checkout the source code and inspect it.

    Assuming that is just a simple python object (which I personally doubt, probably it has some references to other complex object i.e. Symbian C++ object instances), you could try your luck with some of the python serialization libraries like pickle.
    http://docs.python.org/lib/module-pickle.html


    Best regards


    Adenilson

Similar Threads

  1. Sending Binary data over a socket
    By jlague in forum Symbian Networking & Messaging (Closed)
    Replies: 6
    Last Post: 2008-09-06, 22:48
  2. Problem in Sending data using Symbian Socket client to the PC based socket server
    By pankaj.dubey in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2008-02-26, 15:09
  3. Sending Image and audio comment to server from MIDlet
    By pauspling in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2008-02-18, 23:36
  4. simultaneous sending and receiving on socket
    By santosh shetty in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2008-02-07, 15:34
  5. SIP jar180 sending image
    By cs_lcwac in forum Mobile Java General
    Replies: 0
    Last Post: 2006-03-10, 08:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×