hi, I have typed in some code from th said book, the net04.dbpro one in the network programming chapter, but after running it all, it hosts ok, and can list connections with the client connecting ok, but neither the host nor the client receives the messages!
Rem Project: net04
Rem Created: Monday, September 23, 2013
Rem ***** Main Source File *****
#INCLUDE "NetConnect.dba"
REM *** Use a window ***
SET WINDOW ON
SET WINDOW SIZE 500,900
SET WINDOW POSITION 0,0
r = EstablishConnection()
REM *** Send and receive messages ***
DO
REM *** Send message ***
INPUT "Choose number of player to receive message ",playerno
INPUT "Enter your message ", mes$
SEND NET MESSAGE STRING playerno,mes$
REM *** Display any received messages ***
GET NET MESSAGE
WHILE NET MESSAGE EXISTS()
PRINT NET MESSAGE STRING$()
GET NET MESSAGE
ENDWHILE
LOOP
REM *** End program ***
Rem Project: NetConnect
Rem Created: Monday, September 23, 2013
Rem ***** Main Source File *****
#CONSTANT HOST 1
#CONSTANT CLIENT 2
FUNCTION EstablishConnection()
TCPIPno = GetTCPIPNumber()
IPaddress$ = GetIPAddress$()
REM *** Select TCP/IP connection ***
SET NET CONNECTION TCPIPno,IPaddress$
option = HostOrClient()
IF option = HOST
REM *** Host program ***
INPUT "Enter the name you wish to use : ",name$
INPUT "Enter maximum users : ",max
INPUT "Enter session name : ", session$
CREATE NET GAME session$,name$,max,1
ELSE
ListNetSessions()
session = GetSessionToJoin()
INPUT "Enter the name you wish to use : ",name$
JOIN NET GAME session,name$
ListPlayersDetails()
ENDIF
ENDFUNCTION option
FUNCTION GetTCPIPNumber()
result = 0
PERFORM CHECKLIST FOR NET CONNECTIONS
FOR c = 1 to CHECKLIST QUANTITY()
IF LEFT$(CHECKLIST STRING$(c),8) = "Internet"
result = c
ENDIF
NEXT c
If result = 0
PRINT "No connection available. Press any key."
WAIT KEY
END
ENDIF
ENDFUNCTION result
FUNCTION ListNetSessions()
PRINT "Sessions available : "
PERFORM CHECKLIST FOR NET SESSIONS
FOR c = 1 to CHECKLIST QUANTITY()
PRINT c," ",CHECKLIST STRING$(c)
NEXT c
ENDFUNCTION
FUNCTION ListPlayersDetails()
PRINT "Players in session "
PERFORM CHECKLIST FOR NET PLAYERS
FOR c = 1 to CHECKLIST QUANTITY()
PRINT c," Name: ",CHECKLIST STRING$(c)," Local ID : ",CHECKLIST VALUE A(c)," Universal ID : ",CHECKLIST VALUE B(c)," Me? : ",CHECKLIST VALUE C(c)," Host? ",CHECKLIST VALUE D(c)
NEXT c
ENDFUNCTION
FUNCTION HostOrClient()
PRINT "Choose from the following options : "
PRINT " 1 - Host a new session"
PRINT " 2 - Join an existing session"
INPUT "Enter option : ",option
WHILE option < 1 OR option > 2
PRINT "Enter 1 or 2"
INPUT "Enter option : ",option
ENDWHILE
ENDFUNCTION option
FUNCTION GetIPAddress$()
INPUT "Enter the IP address of the HOST machine (xxx.xxx.xxx.xxx) : ",IPaddress$
ENDFUNCTION IPaddress$
FUNCTION GetSessionToJoin()
INPUT "Enter session you wish to join : ",session
WHILE session < 1
PRINT "Enter the session number from the list given"
INPUT "Enter option : ",session
ENDWHILE
ENDFUNCTION session
I type in my case 192.168.0.4 as the host I.P have ublocked the firewalls and even turned them both off when that didnt work! So I have no ideas... Thanks for any help
Hail to the king, baby!
http://davidjohnwheeler.blogspot.co.uk