SIGLENT
148 SSG5000X Programming Guide
4.2
Socket Examples
4.2.1
Python Example
Python is an interpreted programming language that lets you work quickly and is very
portable. Python has a low-level networking module that provides access to the socket
interface. Python scripts can be written for sockets to do a variety of test and
measurements tasks.
Environment: Win7 32bit system, Python v2.7.5
The functions of this example: Opens a socket, sends a query, and closes the socket. It
does this loop 10 times.
Below is
the
code of the script:
#!/usr/bin/env python
#-*- coding:utf-8 –*-
#-----------------------------------------------------------------------------
# The short script is an example that open a socket, sends a query,
# print the return message and closes the socket.
#-----------------------------------------------------------------------------
import socket # for sockets