WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DialUp Networking (DUN) Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Detect when Data Transfer is Finished During Dial-up Networking

Keywords:  wxGetInfo  

Question:

I need to close my dial-up connection upon conclusion of transferring data. What is the syntax for detecting that data is being transferred, and to prevent my DUNDisconnect from activating while data is being transferred?

Answer:

I would use wxGetInfo from the Internet extender to watch the bytes being transferred and when no bytes fly by for awhile, close the connection.

Something like:

dunhandle=dunConnect (sDial)

bytes=0
while 1
TimeDelay(60)
x=wxGetInfo(4,dunhandle)  

if x == bytes then break
bytes = x
endwhile
                                                                                                   
DunDisconnect(dunhandle) 

wxGetInfo Returning -1:

I'm using wxGetInfo and with request code either 3 or 4, (to detect the number of bytes send or received over a dial-up connection), I'm always getting a -1. Any ideas why?

Answer:

If you go to Control Panel -Modems -Properties (of the modem)
                   ->Connection (tab) -Advanced (button)
It will bring you to the Advanced Connection Settings.

The problem you're having has something to do with UNIMODEM causing this to occur.

To see the registry keys (where the transfer information is stored) you need to have the "Record a log file" check box checked so that two Registry keys show up.

So, check the box in the Modems Properties dialog and it should work perfectly (because you will now have the keys in the registry)!!!!

However, there is a downfall to this (minor). In your windows directory, it creates a text file called modemlog.txt and that this file could get pretty big. (For example, I tested my few lines of code, was only connected for 45 seconds (I didn't even pull up a web page because I wanted to have the program connect me and then disconnect me (inactivity)) and the text file was 5K.

But, you can just delete that file after every disconnect and you won't have to worry about it.


Article ID:   W12622
Filename:   Detect when Data Transfer Done during DUN.txt
File Created: 1999:04:15:16:48:30
Last Updated: 1999:04:15:16:48:30