Quote: "I think I have found the problem... I have a 64-bit computer"
Nope, there's something else going on here.
Sometimes the CREATE NET GAME command takes a while to do its thing - around 15 seconds on my machine.
I did notice when I ran an old piece of code I have that if you don't provide an IP address when using SET NET CONNECTION that when the application pops up an IP address entry window, on my machine this is sometimes hidden behind the DBPro window.
Apart from that, the program runs fine on my system, which is Windows 7 64 bit with SP1
The code isn't high quality, but you're welcome to try it:
sync on
add$ = "192.168.2.3"
print "Press S for server mode, or C for client mode"
repeat
k$ = lower$(inkey$())
sync
until k$ = "s" or k$ = "c"
if k$ = "s"
print "Enter SERVER mode"
sync
netsel = LocateTCPIP()
set net connection netsel, add$
create net game "ChatProgram", "Server", 255, 2
print "Off and running"
sync
while escapekey() = 0
` deal with new and lost connections
New = net player created()
if New > 0
send net message string New, "Welcome"
print "Another mug joined : "; New
endif
Old = net player destroyed()
if Old > 0
print "Another one bites the dust : "; Old
endif
` Get new messages, and bounce them right back
message$ = CheckForMessage()
if message$ <> ""
From = net message player from()
Name$ = GetPlayerName(From)
print "Got message from "; Name$; "("; From; ") : "; Message$
send net message string From, message$
endif
sync
endwhile
free net game
else
print "Enter CLIENT mode"
sync
global mystring$
netsel = LocateTCPIP()
set net connection netsel
perform checklist for net sessions
game=1
join net game game, "MyNameHere"
print "Off and running"
sync
clear entry buffer
do
SendNewMessage()
Message$ = CheckForMessage()
if Message$ <> ""
From = net message player from()
Name$ = GetPlayerName(From)
print "Got message from "; Name$; "("; From; ") : "; Message$
endif
sync
loop
endif
function CheckForMessage()
Result$ = ""
get net message
if net message exists() > 0
if net message type() = 3 then Result$ = net message string$()
endif
endfunction Result$
function SendNewMessage()
Msg$ = entry$(1)
for i = len(Msg$) to 1 step -1
if mid$(Msg$, i) = chr$(13)
EnterPressed = 1
exit
endif
next
if EnterPressed
clear entry buffer
send net message string 0, Msg$
else
if mystring$ <> Msg$
print Msg$
mystring$ = Msg$
endif
endif
endfunction
function GetPlayerName(from)
Name$ = "Unknown"
perform checklist for net players
for c = 1 to checklist quantity()
if checklist value a(c) = from
Name$ = checklist string$(c)
exit
endif
next c
endfunction Name$
function LocateTCPIP()
perform checklist for net connections
nettotal = checklist quantity()
for i = 1 to nettotal
if checklist string$(i) = "Internet TCP/IP Connection For DirectPlay" then netsel = i
next a
endfunction netsel
Just fix the IP address at the top before compiling, then run it once as a server, then one or more times as a client - anything typed at a client will be delivered back to that client. The text entry is quite rough, but it demonstrates round-trip messages via a server.