PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV Mobile 2024 → Socket issues
Socket issues
Iniciado por Jim, 17,dic. 2018 17:39 - 4 respuestas
Publicado el 17,diciembre 2018 - 17:39
We are trying to connect to one of our hardware units with a tablet or phone.
We have been doing it with WinDev for years via a computer. It has worked fine over the years.
Using the same method with WinDev Mobile 23 seems to have a small bug.
In the emulator it works. When loaded on a phone or tablet extra bytes show up or even an extra byte overwrites some of the data we are trying to retrieve.

We send and receive all data in 60 byte chunks.

When the data is retrieved by a phone or tablet, there is usually 62 bytes.
Expected,
AA BB CC 02 2A 2A 2A 2A 50 72 6F 76 69 64 65 6E.....20

Actual,
FD FF BB CC 02 2A 2A 2A 2A 50 72 6F 76 69 64 65 6E....20 FF (FF tacked onto the end)


Test Code below.

bufUserPage2 is Buffer on 60 = [0xaa,0xbb,0xcc,0x02] //unit name, F or C, IP address
bufTest is Buffer on 60 = [0x2a,0xcd,0xdc,0xba] //Model number, Family, Revision etc.

j is int
rslt is boolean
ReadError is string
IP is string
ReturnBuffer is Buffer

STC_size = Length(bufUserPage2)
ListAdd(LIST_One,"size of buffer " + Length(bufUserPage2) + CR)
IP = EDT_IP_Address



FOR j = 5 TO 60

bufUserPage2[[j]] = 0x00 //Padding the buffer to 60 for phones and tablets

END

ListAdd(LIST_One,"size of buffer " + Length(bufUserPage2) + CR)


Socket.Option = SocketNagleOff

rslt = SocketConnect("sc",10001, IP,5000)
IF rslt = False THEN

EDT_Buffer = "Failed to connect"
ReadError = "Failed to connect with " + IP
Info(ReadError)
ListAdd(LIST_One,"failed to connect" + CR) //for troubleshooting
ErrorInfo(errFullDetails)

ELSE

ListAdd(LIST_One,"connected" + CR) //for troubleshooting
rslt = SocketChangeTransmissionMode("sc",SocketNoEndTag,"THE-END")
IF rslt = False THEN
SocketClose("sc")
ReadError = "Unable to change Transmission Mode to 'socketnoendtag'"
Info(ReadError)
ListAdd(LIST_One,"transmission mode failed" + CR) //for troubleshooting
ELSE
EDT_Buffer = "Changed trans"
ListAdd(LIST_One,"transmission mode OK" + CR)
END

ListAdd(LIST_One,Length(ReturnBuffer) + CR) //for troubleshooting
SocketWrite("sc",bufUserPage2)

cntr is int = 0

LOOP
ReturnBuffer = ReturnBuffer + SocketRead("sc", False, 5000) // 3 second timeout
cntr += 1
STC_size = "wait"
DO WHILE Length(ReturnBuffer) < 60 AND cntr < 9 // 4/12/17 was cntr < 7

// junk is buffer = SocketRead("sc", False, 5000)
// ListAdd(LIST_One,"junk is " + junk + CR) //for troubleshooting
SocketClose("sc")



EDT_Buffer = BufferToHexa(ReturnBuffer)

STC_size = Length(ReturnBuffer)

END
Publicado el 19,diciembre 2018 - 20:23
More info.

We took our unit out of the equation and just sent a small string back and forth.
Boss used hyper terminal, and I the app.
In the emulator it works.
On the phone it overwrites some of the needed data. FD FF is the common theme.
We tried using an <EOF> at the end. Again in the emulator it worked. The phone wouldn't get anything.

This is starting to look like a bug. I am currently updating XCode and am going to test it on an IPhone.

Any help would be appreciated.


Jim
Publicado el 19,diciembre 2018 - 22:17
IPhone, did not work at all.
SocketConnect does not even connect.
In the emulator it worked though.
Permissions issue maybe with IOS?

Jim
Publicado el 19,febrero 2019 - 16:48
Good news.
WinDev sent me a zip file with a few updates to the software.
It seems to work now.

https://stg.webdev.info/Telechargement_Support_WEB/US/telec_ST.awp…

Jim
Miembro registrado
794 mensajes
Popularité : +40 (42 votes)
Publicado el 20,febrero 2019 - 07:48
Thank you :-)


Rubén