Zack

by Michael Calkins (Login MCalkins)
Moderator

 
From the discussion in the other part of this thread, unless I am mistaken, it looks like you are still trying to broadcast your IP address using a web site instead of dynamic DNS. Did you ever get dyndns working? I believe that it provides the easiest, simplest solution for the problem.

Otherwise, have a look at this QBASIC 1.1 code. It gets your current IP address from checkip.dyndns.com, and uploads it to a web host using Windows's built in command line FTP program. Obviously, you will need to substitute your own host name, user name, and password. But, it works, as you can see from:

http://www.qbasicmichael.com/ip.txt

This works in QBASIC 1.1. It would seem that you could do something similar from QB64 without needing to SHELL to external programs.

Then, it is a simple matter for the client to get it from there, and do whatever it is that needs to be done.

Regards,
Michael

P.S.

As I've said, the command line FTP utility that comes with Windows does not support passive FTP. It will have to use active FTP. Windows Firewall will pop up asking you if you want to allow it. Active FTP represents a slight security issue as far as you firewall is concerned, because it means allowing incoming connections to any high numbered port.

http://slacksite.com/other/ftp.html
----------

'note: overwrites "ip.htm", "ip.txt", and "script.txt" in the current folder
'public domain, may 2011, michael calkins

DEFINT A-Z
DIM t AS STRING

'get current ip address. If we are connected directly to the internet, with
'no NAT, you could parse redirected output from ipconfig. However, if you are
'behind a NAT router/gateway, we can use checkip.dyndns instead:

SHELL "del ip.htm"
SHELL "\calkins\wget http://checkip.dyndns.com/ -O ip.htm"
OPEN "ip.htm" FOR INPUT AS 1
LINE INPUT #1, t
CLOSE
t = MID$(t, INSTR(t, ":") + 2)
t = LEFT$(t, INSTR(t, "<") - 1)
PRINT t
OPEN "ip.txt" FOR OUTPUT AS 1
PRINT #1, t;
CLOSE

'qbasic makes the filename uppercase, but i want it to be lowercase.
SHELL "cmd /C rename ip.txt ip.txt"

'generate an ftp script file
OPEN "script.txt" FOR OUTPUT AS 1
PRINT #1, "QBASICMI@qbasicmichael.com" ' username
PRINT #1, "oh, but wouldn't you like know? ;-)" 'password
PRINT #1, "cd www" 'folder
PRINT #1, "binary"
PRINT #1, "put ip.txt"
PRINT #1, "close"
PRINT #1, "quit"
CLOSE

'use -s:filename instead of redirecting input
SHELL "ftp -s:script.txt ftp.qbasicmichael.com"
SYSTEM



    
This message has been edited by MCalkins on May 29, 2011 5:47 PM

Posted on May 29, 2011, 2:37 PM

Respond to this message   

Return to Index

Response TitleAuthor and Date
passive versionMichael Calkins on May 29
 Why is /calkins/ in there?Clippy on May 29
  becauseMichael Calkins on May 29
   What is the correct location?Clippy on May 29
    do you have wget?Michael Calkins on May 30
     * Yep, I needed it! Thank you! :-)Clippy on May 30

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement