Bonjour,
J'ai besoin d'interroger une balance à partir d'un AS400
Le constructeur m'a indiqué qu'il était possible de mettre un convertisseur RS232-> Ethernet (car l'AS400 n'est pas à côté de la balance)
Je souhaite donc écrire un programme Cobol de préférence ou RPG pour lire les données de la balance. Je n'ai pas d'expérience particulière pour la communication avec d'autres ordinateurs (j'ai tout de même déjà utilisé quelques fois un fichier ICF mais cela fait presque 20 ans - connexion avec un Microvax et aussi un terminal portable - donc par un câble rs232)
Si quelqu'un peut m'aider
Merci
Voici l'exemple que l'on m'a donné en VB6 sous Windows
The winsock control is a standard control in visual basic 6. (mswinsck.ocx)
The most important code is written below.
(Extra code is usefull to make sure the connection is complete before afsking the weight. Or to wait until the answer from te scale is complete)
1) make a connection
Winsock1.RemoteHost = 192.168.1.201 '(IP-adres of the Serial-to-Ethernet converter)
Winsock1.RemotePort = 4001 '(port of the Serial-to-Ethernet converter)
Winsock1.Connect
2) send the $-sign to ask the weight
Winsock1.SendData("$")
3) wait for the response(Winsock.DataArrival is an event in the winsock-control)
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData
end sub
4) Extract the weight from strData
5) Close the connection
Winsock1.Close
Partager