CreateNetworkServer()

Everything else that doesn't fall into one of the other PB categories.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

CreateNetworkServer()

Post 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).
Last edited by AND51 on Sun Dec 17, 2006 11:24 am, edited 1 time in total.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post 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!
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Nevertheless, '#server' is wrong, a long is required, not a <WHATEVER>...
PB 4.30

Code: Select all

onErrorGoto(?Fred)
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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:
quidquid Latine dictum sit altum videtur
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post 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?? :?:
PB 4.30

Code: Select all

onErrorGoto(?Fred)
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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... ;)
quidquid Latine dictum sit altum videtur
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post 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.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post 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????
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post 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)
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post 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
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post 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.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Ah, ok thank you.

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

Code: Select all

onErrorGoto(?Fred)
Post Reply