

Row ( int): Row position to which the cursor should be moved.Ĭol ( int): Column position to which the cursor should be moved.

Description: Erase character previous character (ASCII BS).Description: Delete character next to the cursor (ASCII DEL).Description: Send back Tab to the host (go to start of previous input field).Description: Send Back space to the host ().Description: Send a F (Function) key - F1, F2, F3.Description: Send the Enter key to host.Description: Disconenct the client from the host.Description: Connect the client to the host.Once the client object (P3270Client class) is created, the following methods can be used to interact with the host. # Start sending your commands to the host. Import the client class from the library: NB: Make sure that you're using the python3 version of the pip command. InstallationĪ simple pip command brings the library to your environment:

However, to get access to some of the more advanced functionality in the 5250 protocol, I have used IBM's own keymapping documentation 3270 keyboard mapping for Telnet servers.

For example, moving the cursor, sending text or pressing enter. Most of the functionality is the same from the 3270 to the 5250 protocol. As the P3270 library was a bit behind, I have added a lot of functionality and the updated version can for now be found here.
#Mocha tn5250 cannot connect code
Credit goes to the original developer Mossaab Stiri, his code is available at and it can be found at PyPi. Second, it relies on the P3270 python library. It is required to have the s3270 installed on your system - you can learn more here: This is library is built relying on first of all the s3270 utility. A Python library to access IBM i / AS400 hosts with a TN5250 emulator.
