Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Net Message String$() Iteration problem

Author
Message
Scuba Ian
21
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 30th Aug 2004 03:27
I am trying to write a very simple chat program. However I seem to always run across the same problem. When printing the queue of incoming messages to the screen I always end up with just message one, but the correct ammount of times. So if I have received 4 messages I will get message one repeated 4 times on screen. I have tried simplifing the code to work out what I am doing wrong but nothing works....



Any ideas?

Ian.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Aug 2004 05:24
I haven't used those commands before, but from what I gathered from the help file, that looks to be correct.

"eureka" - Archimedes
matt rochon
23
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 30th Aug 2004 12:31
i recently had this same problem

i got it to work if it was just arbitrarily getting a new message every loop, try my input function that doesnt hang when ur typing and just put the get message call in ur main loop

my function isnt great but its working



try using this algorithm

DO
CHECK IF ENTER KEY IS PRESSED
SEND THE CURRENT MESSAGE
ENDIF
GET THE NEXT CHARACTER FOR THE MESSAGE
GET THE NEXT INCOMING MESSAGE
PRINT IT
LOOP
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Aug 2004 15:40
alternatively, i believe that someone wrote a network dll awhile back. maybe its got something in it.

"eureka" - Archimedes
Scuba Ian
21
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 30th Aug 2004 20:08
Thanks guys,

I don't beleive it is a problem with the sending of the messages. If I run three separate instances of the program (call them A B and C) and send messages between them it all works fine until... Any particular instance has more than one incoming message to process. In which case it just prints the oldest message multiple times. The number of messages is always correct, just the content is wrong.
I have also put a sender ID section in the print message routine and this gives results consistanct with the problem above i.e.



Prog A Sends > A1
Prog B Sends > B1
Prog C displays
A > A1
A > A1

rather than the hoped for

A > A1
B > B1

Ian.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Aug 2004 09:15
So something is wrong with how the queue data is stored internally

"eureka" - Archimedes

Login to post a reply

Server time is: 2026-07-28 07:08:48
Your offset time is: 2026-07-28 07:08:48