Wednesday, April 21, 2010

Network Testing Utilities and Functions with AutoIT

This is interesting to a very high level. I came across the networking utilities of AutoIT. The tool has a very good set of network related functions which could be made use in network testing. There are options for sending and receiving packets through AutoIT. Both TCP and UDP messages could be handled with the tool! Interesting, isn’t it?

One can do socket programming with this testing tool. Believe me, you can open a socket, send and receive TCP/UDP packets, Listen on a specific port, do messaging, etc. with AutoIT. If one has the idea, then creating a server is not so tough with this tool! Below listed are the functions which are available with AutoIT for playing around with the Messages. These are other than what I have mentioned in the earlier post, which talked about FTP programming.
  • TCPStartup – To Start TCP services
  • TCPConnect – To create a socket and connect to the specified server
  • TCPSend – Send TCP data on a connected socket
  • TCPListen – Creates and starts listening on a socket for incoming connections
  • TCPAccept – Permits an incoming connection on a listening socket
  • TCPRecv – Receives data from a connected socket
  • TCPNameToIP – To convert internet name into the IP address
  • TCPCloseSocket – Closes a TCP socket
  • TCPShutdown – Shuts down the TCP services on the machine
  • UDPStartup – To start the UDP services
  • UDPOpen – Opens and connects a UDP socket to a server
  • UDPBind – Creates a socket bound to an incoming connection
  • UDPSend – Send UDP data on a connected socket
  • UDPRecv – Receives UDP data on a connected socket
  • UDPCloseSocket – Closes the UDP socket
  • UDPShutdown – Shuts down the UDP services on the machine
For explanatory purpose, I have created an example of PC-to-PC Messaging system utilizing these functions. It utilizes the TCP messaging functions. There are two codes which I have created, of which one acts as the server and the second as client. The client establishes connection with the server and gets authenticated with a welcome message. There onwards, messages could be exchanged between these two softwares. This is very much similar to a chat engine, and could in fact be used as such, with some little modifications. Please find the executable here. I have also uploaded the Source code, which could be downloaded here.

I will come up with more examples and more on automated testing of UDP based protocols like TFTP. It is really easy and handy to use AutoIT, because it is a very simple function call which needs to be made for all these.

No comments:

Post a Comment