Page 1 of 1

CreateNetworkServer()

Posted: Sat Dec 16, 2006 8:29 pm
by AND51
Edit: OOOPS! Unfortunately I posted in the wrong sub-forum... :oops:



Hello!

My friend has discovered heavy bug in CreateNetworkServer()

Danger! This bug fills your RAM and pagefile!!!

Code: Select all

If InitNetwork() = 0
  MessageRequester("Fehler", "Kann Netzwerkumgebung nicht initalisieren!", 0)
  End
EndIf

Port = 6632
Buffer = AllocateMemory(1000)

If CreateNetworkServer('#server', Port)
  MessageRequester("G4you - Server", "Server created (Port "+Str(Port)+").", 0)
  End
EndIf
Look at #server! The 'atostrophs', the compiler/debugger does not say anything, but my friend has to restart his PC everytime to ensure his PC working correctly.

This bug is confirmed by me (PB 4.01/BETA).

Posted: Sat Dec 16, 2006 9:02 pm
by Derek
It actually doesn't matter what you type between the apostrophes as long as it's not longer than 8 characters.

Longer than 8 and you get an error.

If you DEBUG '#server' on my computer you get 9978503734125938.

And, your right, it does eat all your ram!

Posted: Sat Dec 16, 2006 9:23 pm
by AND51
Nevertheless, '#server' is wrong, a long is required, not a <WHATEVER>...

Posted: Sat Dec 16, 2006 10:00 pm
by freak
Since when does a missing error message classify as a "HEAVY BUG" (scream, shout, crazyness... :P ) ??

After all, it only concerns those who do not know how to write a string in PB,
its a bug allright, but "HEAVY", well... :roll:

Posted: Sat Dec 16, 2006 10:21 pm
by AND51
I don't know what you mean, can you rewrite it in german?

I wrote HEAVY, because this bug eats >3 GB of my pagefile/RAM. Moreover in my opinipn
'#server'
is neither a constant nor a string... so what?? :?:

Posted: Sat Dec 16, 2006 11:51 pm
by freak
German: (same as my above post)

Ich meinte nur du sollst keine Panik schieben. Es ist schließlich nur
eine Fehlermeldung die der compiler nicht ausgibt. Der Befehl selbst
funktioniert ja einwandfrei.

Natürlich ist das ein bug der behoben werden muss, aber das ganze
als "HEAVY BUG" zu bezeichnen ist dann doch ziemlich übertrieben.
Schließlich betrifft es ja nur die, die nicht wissen wie man in PB einen
String schreibt... ;)

Posted: Sun Dec 17, 2006 11:27 am
by AND51
OK, habe den Titel geändert.

Nun, mein freund ist Anfänger und hat da zufällig diesen fehler "ausgegraben". Das ist wie OpenWIndow() in 3.94, es war möglich, einen String anstelle der Flags zu übergeben, also läuft da doch irgendetwas schief?

Und dass meine Auslagerungsdatei auf 3 GB anschwillt ist schon etwas heftig...

Strings werden ja auch mit doppeltem "Anführungszeichen" geschrieben, weshalb mir das in einfache 'Anführungszeichen' gesetzte '#server' noch spanischer als ohnehin schon vorkommt!


Fazit: Ich sehe ein, das HEAVY war etwas übertrieben :roll: Aber trotzdem sollte hier nur eine einwadnfreie ID (Zahl oder Konstante) akzeptiert werden.

Posted: Sun Dec 17, 2006 12:36 pm
by Fred
It's because you are using a very big number, as an indexed identifiant. We can add a debugger check, but there is nothing wrong in it.

Posted: Sun Dec 17, 2006 3:25 pm
by AND51
I thoguht so.

Is this the reason, why the help file says: "IT's better to start enumeration at 0 and not at 100 (for example at Gadgets, Images, etc.)?

You are all right, but there is a thing which I still don't understand:

'#server' isn't either a string nor a number, so what is it then????

Posted: Sun Dec 17, 2006 3:28 pm
by Derek
When you use ' you get the asc value of the contents of the string, so

a='A'
debug a

Answer 65

a='AB'
debug a

Answer 16706 (65*256 +66)

Posted: Sun Dec 17, 2006 5:19 pm
by Nik
In other cases it's better to start enumerations at low number it's because if you enumerate a gadget with the ID =100 PB will allocate Memory for 100 gadgets

Posted: Sun Dec 17, 2006 5:22 pm
by AND51
Derek wrote:When you use ' you get the asc value of the contents of the string
So, this is feature and not a bug? But why isn't this listed in PB documentation?


@ Nik: Thx, I already know that and I wll tell it my friend.

Posted: Sun Dec 17, 2006 6:59 pm
by Fred
Yes, ' is not a string, but a number, like in C. BTW, you are right, it's not in the doc and it should be added.

Posted: Sun Dec 17, 2006 11:57 pm
by AND51
Ah, ok thank you.

Now, ' is no longer a miracle for me :roll: