Hi folks, Recently we've build the functionality to send text-messages (SMS) to mobile phones in our application. It's the first time I've programmed HTTP Post / Get, and I don't understand it all. When the user sends one message, it's all fine. But when the user sends i.e. 300 text-messages to 300 phones we get error 8982. The exact error is : Invalid event-procedure context encountered when trying to invoke event procedure 'getResponse'. (8982). The functionality is build in a .w window. It seems that when all the message are send and the window gets closed, the session is still sending messages but the getResponse procedure isn't available anymore (it's in the .w). Strange because in the code there's a WAIT-FOR READ-RESPONSE OF gsocket. I'm surely missing something, but I can't find out what exactly. In attachment I placed the code (it's an include). Hopefully someone is willing to have a look at it and help me out. This is on OE11.3.2 - windows 7. Kind regards Bart Syryn
Hi Peter,
I finally found it. You've pointed me in the right direction, saying that the socket maybe still open. Somewhere in the code there's a test, IF G-listto = "" THEN NEXT. So when there was no Phone number, than the message isn't send and the program goes on with the next number. But at that point, the socket was open and a new one was created. So I changed it to DISCONNECT - DELETE and then NEXT, and it solved my problem.
Thanks for pointing me in the correct direction.
Kind regards
Bart Syryn
Hi Peter,
Thanks for replying, but I don't understand your suggestion. Do you suggest to place the delete G-socket in the main block (on close of this procedure ) ? The socket is created in the loop in procedure : http-sendsms.
Kind regards,
Bart S.
Hi Bart,
In the code you sent (which I've trimmed down), there's a G-Socket:DISCONNECT() line near the end (edit: line 19). I was wondering whether that line of code was executed when the user just closes the window (ie via [X] or some other means). If it does not, then you should clean up the socket on the window's ON CLOSE OF THIS-PROCEDURE trigger (or similar). I suspect that the socket is still open, even when the window has closed, because that line (19) deleting the socket in http-sendsms fails to run.
PROCEDURE http-sendsms : ASSIGN P-error = FALSE. FOR EACH ttsendsms WHERE ttsendsms.sendsms: CREATE SOCKET G-Socket. G-Socket:CONNECT('-H ' + G-Host + ' -S 80') NO-ERROR. G-Socket:SET-READ-RESPONSE-PROCEDURE('getResponse',THIS-PROCEDURE). /* snipped a lot */ IF G-postdata <> ? THEN DO: RUN PostRequest (INPUT '/send.php', INPUT G-postData). WAIT-FOR READ-RESPONSE OF G-Socket. END. IF VALID-HANDLE(P-statushandle) THEN ASSIGN P-statushandle:SCREEN-VALUE = "Versturen: " + STRING(G-totaal-sendsmsen) + "/" + STRING(P-aantalsms). G-Socket:DISCONNECT() NO-ERROR. DELETE OBJECT G-Socket. END. END PROCEDURE.
Hi Peter,
When all the messages are send,there's a message-box that gives the information and after pressing 'ok' the window is closed programmaticaly.
I've placed the two lines (G-socket:disconnect and Delete object G-socket) in the window's ON CLOSE OF THIS-PROCEDURE, but that didn't solve the problem ...
Any other suggestions ...
Kind regards
Bart S.
Hi Peter,
I finally found it. You've pointed me in the right direction, saying that the socket maybe still open. Somewhere in the code there's a test, IF G-listto = "" THEN NEXT. So when there was no Phone number, than the message isn't send and the program goes on with the next number. But at that point, the socket was open and a new one was created. So I changed it to DISCONNECT - DELETE and then NEXT, and it solved my problem.
Thanks for pointing me in the correct direction.
Kind regards
Bart Syryn
Hi Peter,
I finally found it. You've pointed me in the right direction, saying that the socket maybe still open. Somewhere in the code there's a test, IF G-listto = "" THEN NEXT. So when there was no Phone number, than the message isn't send and the program goes on with the next number. But at that point, the socket was open and a new one was created. So I changed it to DISCONNECT - DELETE and then NEXT, and it solved my problem.
Thanks for pointing me in the correct direction.
Kind regards
Bart Syryn
Flag this post as spam/abuse.