tags:

views:

430

answers:

2

I want to stream a binary data using python. I do not have any idea how to achieve it. I did created python socket program using SOCK_DGRAM. Problem with SOCK_STREAM is that it does not work over internet as our isp dont allow tcp server socket.

I want to transmit screen shots periodically to remote computer. I have an idea of maintaining a Que of binary data and have two threads write and read synchronously. I do not want to use VNC .

How do I do it?

I did written server socket and client socket using SOCK_STREAM it was working on localhost and did not work over internet even if respective ip's are placed. We also did tried running tomcat web server on one pc and tried accessing via other pc on internet and was not working.

+2  A: 

There are two problems here.

First problem, you will need to be able to address the remote party. This is related to what you referred to as "does not work over Internet as most ISP don't allow TCP server socket". It is usually difficult because the other party could be placed behind a NAT or a firewall.

As for the second problem, the problem of actual transmitting of data after you can make a TCP connection, python socket would work if you can address the remote party.

phsiao
+1  A: 

SOCK_STREAM is the correct way to stream data.

What you're saying about ISPs makes very little sense; they don't control whether or not your machine listens on a certain port on an interface. Perhaps you're talking about firewall/addressing issues?

If you insist on using UDP (and you shouldn't because you'll have to worry about packets arriving out of place or not arriving at all) then you'll need to first use socket.bind and then socket.recvfrom in a loop to read data and keep track of open connections. It'll be hard work to do correctly.

PAG