| View previous topic :: View next topic |
| Author |
Message |
webdaddy Contributor


Joined: 14 Nov 2004 Posts: 151 Location: Raleigh NC
|
Posted: Sun Nov 14, 2004 4:18 am Post subject: Help with Writing to Files |
|
|
Im trying to log all messages received via a UDP connection to a log file in a VDS application. So far I have been unable to figure it out. Below is a snippet of the code the im using.
| Code: | :UDP-SERVER1ONMESSAGE
%A = @INTERNET(udp-server,message,1)
list add,list1,@DATETIME(h:nn:ss)@TAB()@TAB()@DATETIME(mmm d yyyy)@TAB()@TAB()%A
binfile open,4,C:\test\log.txt
binfile write,4,text,%A
BINFILE CLOSE,4
goto evloop |
Can somebody tell me what im doing wrong?
Thank you for your time and assistance.
Webdaddy |
|
| Back to top |
|
 |
webdaddy Contributor


Joined: 14 Nov 2004 Posts: 151 Location: Raleigh NC
|
Posted: Sun Nov 14, 2004 10:08 am Post subject: Problem Solved - Writing to Log File |
|
|
Nevermind. I figured it out.
To keep thread integrity however here is what I ended up doing.
| Code: | :UDP-SERVER1ONMESSAGE
%A = @INTERNET(udp-server,message,1)
list add,list1,@DATETIME(h:nn:ss)@TAB()@TAB()@DATETIME(mmm d yyyy)@TAB()@TAB()%A
BINFILE OPEN,4,C:\SSyslog\log.txt,APPEND
BINFILE WRITE,4,TEXT,@DATETIME(h:nn:ss)@TAB()@TAB()@DATETIME(mmm d yyyy)@TAB()@TAB()%A
BINFILE CLOSE,4
goto evloop |
|
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sun Nov 14, 2004 12:38 pm Post subject: |
|
|
Hi Webdaddy, welcome at VDSWORLD...
The way you did it, does work, but it's better to create a logfile with the list command:
| Code: | :UDP-SERVER1ONMESSAGE
%A = @INTERNET(udp-server,message,1)
list add,list1,@DATETIME(h:nn:ss)@TAB()@TAB()@DATETIME(mmm d yyyy)@TAB()@TAB()%A
list create,30
list loadfile,30,C:\SSyslog\log.txt
list add,30,@DATETIME(h:nn:ss)@TAB()@TAB()@DATETIME(mmm d yyyy)@TAB()@TAB()%A
list savefile,30,C:\SSyslog\log.txt
list close,30
goto Evloop |
Btw. I added the [ vds ] tag to your posts for better readability...  _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Nov 14, 2004 3:21 pm Post subject: |
|
|
Either way will work, however, and BINFILE may be faster in some cases,
such as with large files. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
webdaddy Contributor


Joined: 14 Nov 2004 Posts: 151 Location: Raleigh NC
|
Posted: Fri Nov 19, 2004 7:05 pm Post subject: Results of Testing |
|
|
I tested this both ways and yes both ways work fine. But the performance seems better with Binfile and since I have no way of knowing just how much traffic will be generated I think Im gonna stick with BINFILE.
I stored the other code though to my reuseable snippets archive. Might come in handy for other applications. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|