We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,661 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Tcp/Ip control Python

I work in the AV industry and there is a whole set of hardware/software for controlling Ip and serial devices.

I'm interested in writing some python code for bench testing projectors and video teleconference unuts, as I think it would be easier and more efficient and a good way to do something practical with python.

So if I know that a device of IP addres 192.168.1.50 communicates on port 5149 and takes ascii commands followed by a carriage return what does that look like? In the AV world of pseudo programming one doesn't do much beyond
using a command to send a string i.e. send_string device:port:system, (this info usually points at an ip address specified elsewhere) 'power=1',0x0d or something like that. What does the ASCI command power=1 followed by a carriage return look like in python. Do we have to send each invididual
ascii character or can we store the string in a tuple?

And what about devices that are all hex driven i.e. 0x0d,data1,data2, cksum

I'm fairly new to python and don't come from a traditional programming background so I'm just curious how you
send information from an ip address and then also parse and see what is coming back.

2
Contributors
2
Replies
1 Hour
Discussion Span
10 Months Ago
Last Updated
3
Views
tunisia
Newbie Poster
12 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I suppose you connect a socket to ("192.168.1.50", 5149) and then invoke sock.sendall("power=1\n"). See the socket module documentation and try to run some code.

Gribouillis
Posting Maven
Moderator
3,101 posts since Jul 2008
Reputation Points: 1,130
Solved Threads: 761
Skill Endorsements: 11

I cannot believe it might be that simple. Very cool. Thank you!

tunisia
Newbie Poster
12 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0621 seconds using 2.69MB