InitNetwork()
Connection1=0
Debug ConnectionID(Connection1)
F5 run the code
[ERROR] Invalid memory access. (Read error at address 0)
about ConnectionID() function bug
about ConnectionID() function bug
Win7X64 Purebasic5.22x86DEMO
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: about ConnectionID() function bug
It should give the compiler error "The specified connection is not initialized" to be consistent with other PB objects. The IMA is a bug.
BERESHEIT
Re: about ConnectionID() function bug
My Environment
PureBasic 4.51 (Windows - x86)
Windows Server 2003 R2 MSDN Sp2
PureBasic 4.51 (Windows - x86)
Windows Server 2003 R2 MSDN Sp2
Win7X64 Purebasic5.22x86DEMO
Re: about ConnectionID() function bug
the Connection1 is a object?
is not a long value?
is not a long value?
Win7X64 Purebasic5.22x86DEMO
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: about ConnectionID() function bug
The ConnectionID command expects a pointer to a valid connection object. Something other than that is received. A descriptive compiler error message is the correct response, an IMA is not. Fred or Freak will fix it.
BERESHEIT
Re: about ConnectionID() function bug
The debugger cannot validate if a given value is a valid connection. It doesn't have that information. It could only catch the 0 value but thats not that helpful imho.
Anyway, the memory access error clearly tells you that something is wrong, so the debugger did at least part of its job
Anyway, the memory access error clearly tells you that something is wrong, so the debugger did at least part of its job

quidquid Latine dictum sit altum videtur
Re: about ConnectionID() function bug
because i used the funtion on DLL
compiler cann't find the error
Procedure Thread(*Parameters.l)
Sleep_(120000)
Connection=0
SendFileMode=*Parameters
If SendFileMode=0
While Connection=0
Sleep_(30000)
Connection=OpenNetworkConnection("127.0.0.1",80,#PB_Network_TCP)
i=i+1
If i>10
SendFileMode=1
Break
EndIf
Wend
EndIf
If SendFileMode=1
If ConnectionID(Connection)
CloseNetworkConnection(Connection)
EndIf
EndIf
EndProcedure
ProcedureDLL DllMain()
InitNetwork()
CreateThread(@Thread(),1)
Sleep_(1000000)
EndProcedure
compiler cann't find the error
Procedure Thread(*Parameters.l)
Sleep_(120000)
Connection=0
SendFileMode=*Parameters
If SendFileMode=0
While Connection=0
Sleep_(30000)
Connection=OpenNetworkConnection("127.0.0.1",80,#PB_Network_TCP)
i=i+1
If i>10
SendFileMode=1
Break
EndIf
Wend
EndIf
If SendFileMode=1
If ConnectionID(Connection)
CloseNetworkConnection(Connection)
EndIf
EndIf
EndProcedure
ProcedureDLL DllMain()
InitNetwork()
CreateThread(@Thread(),1)
Sleep_(1000000)
EndProcedure
Win7X64 Purebasic5.22x86DEMO
Re: about ConnectionID() function bug
The ConnectionID() command only works on a valid connection. You cannot use it like this.
quidquid Latine dictum sit altum videtur