server-client include

Share your advanced PureBasic knowledge/code with the community.
MyTrial
Enthusiast
Enthusiast
Posts: 165
Joined: Thu Nov 30, 2006 11:47 am

Post by MyTrial »

Hello gnasen
I have maybe a silly question: How do I know that a file is completely loaded? Your refresh parts which show how many percent of the file is done doesn't never show 100%. Is there any way to get that?
Sigi
gnasen
Enthusiast
Enthusiast
Posts: 282
Joined: Wed Sep 24, 2008 12:21 am

Post by gnasen »

if data or files arive, they are debugged in the debugger output. If you send a file with maybe 3mb, you will see that the info in the debugger pops up, when it finishes.

you can find it here:

Code: Select all

;check incoming events, you can add some by yourself (check "get_typus" enum in include file)
ForEach _sc_net_get()
  ...

  Case #_sc_typus_file
    ;/Receive (to example) a File
    Debug "file: " + _sc_net_get()\get_filePath

  ...
next
pb 5.11
MyTrial
Enthusiast
Enthusiast
Posts: 165
Joined: Thu Nov 30, 2006 11:47 am

Post by MyTrial »

Thanks for your information.
Have a nice weekend.
Sigi
MyTrial
Enthusiast
Enthusiast
Posts: 165
Joined: Thu Nov 30, 2006 11:47 am

Post by MyTrial »

Hi gnasen
I have a next question. My application should work once started day for day on up to 20 machines. When I have a look to the reserved memory of that application the memory use is growing up. When I start I have 1 MByte and after 24 hours I have 4 MByte and so on. And I have some machines where the program crashes after it growed to nearly 3 MByte. Is it possible that your nice code forgets to free some memory? Or do you have a idea from where this comes up? Or is there a way to check if memory is allocated but no more used inside the application all hour? I don't want to restart the program all 12 hours.
Thanks for your help.
Sigi
gnasen
Enthusiast
Enthusiast
Posts: 282
Joined: Wed Sep 24, 2008 12:21 am

Post by gnasen »

Ups, seems to be a little dirty leak out there.
If I have some time on the weekend, I may take a look for it.
I may also convert it to pb4.3 since I ve been forced to update my own version before some days from 4.2 to 4.3 because of some 3d stuff :D
pb 5.11
MyTrial
Enthusiast
Enthusiast
Posts: 165
Joined: Thu Nov 30, 2006 11:47 am

Post by MyTrial »

Hello gnasen

I did a little search for my program crashes.

- I changed all
If _sc_net_send()\send_file
to
If IsFile(_sc_net_send()\send_file)
- Arround of all
ReadData(_sc_net_send()\send_file,...
I put a
If IsFile(_sc_net_send()\send_file)
ReadData(_sc_net_send()\send_file,...
endif
- All parts of the following I commented the FreeMemory part out because they give sometimes crashes.
If _sc_net_get_temp()\get_mempos > 0
FreeMemory(_sc_net_get_temp()\get_mempos)
_sc_net_get_temp()\get_mempos = -1
EndIf
Now I could test over a few hours and no crash comes up. The growing memory is still there.

How should I handle the FreeMemory parts correctly which I commented out? I get the error messages "Invalid memory access. (write error at address ...)" and "Invalid memory access. (read error at address ...)" if I let them in.

Thanks for your help.
Sigi
gnasen
Enthusiast
Enthusiast
Posts: 282
Joined: Wed Sep 24, 2008 12:21 am

Post by gnasen »

this is very strange.

I had no crash in any debug session I ever used that. What version of PB are you using?

For a bigger fix you will have to fix it yourself or wait some time, because studys are eating all my time.

However, can you post me more details of your machine, like OS pb version etc?

Maybe I will find some time to repair that.
pb 5.11
MyTrial
Enthusiast
Enthusiast
Posts: 165
Joined: Thu Nov 30, 2006 11:47 am

Post by MyTrial »

Hello gnasen

I am working with PB 4.30 on a Win XP Pro SP2. Like I said the result of the compiled program is different by hardware (memory size and maybe more) and os (win 2k, win xp pro, win 2003 server). I will have a look if I find more out of this problem. And don't stop your study, thats more important for your live.

Sigi
Post Reply