I have just made some simple code for a tcp/ip connection.
This may be helpfull for someone.
there are 2 programs the server and the client
server:
Quote: "rem this command connects you to your own computer with a tcp/ip connection
rem "127.0.0.1" is the address to connect to your self
rem the number 3 is a tcp/ip connection
set net connection 3,"127.0.0.1"
rem this create's a network game and you are the host computer
rem "game1"=name of game
rem "host"=Name of player
rem 2 means a client host game that means it sends information to a server which
rem which then sends it to all the clients
create net game "game1","host",2
rem for fun this prints connected when you connect.
print "connected"
rem start a simple loop
do
rem this is an input command so you can send information over the net
input "type: ",txt$
rem this command sends a some text information across the net connection
send net message string 0,txt$
rem this command is collecting any information that may have been sent to the computer
get net message
rem this command makes text$ have the same value as the string sent over the net
text$=net message string$()
rem this command reads the text$ to make sure it has some text in
if text$>""
rem this command prints the text$'s text.
print text$
rem this ends the if command
endif
rem this ends the loop
loop"
Client:
Quote: "rem ---------------------------
rem This makes a net connection.
rem number 3 means tcp/ip connection.
rem the "127.0.0.1" is an ip address which connects you to your own computer
set net connection 3,"127.0.0.1"
rem the next command allows you to join the game one the net connection
join net game 1,"client"
rem for fun this will tell you that you are connected after it has connected
print "connected"
rem a simple loop
do
rem this is an input command so you can send information over the net
input "type: ",txt$
rem this command sends a some text information across the net connection
send net message string 0,txt$
rem this command is collecting any information that may have been sent to the computer
get net message
rem this command makes text$ have the same value as the string sent over the net
text$=net message string$()
rem this command reads the text$ to make sure it has some text in
if text$>""
rem this command prints the text$'s text.
print text$
rem this ends the if command
endif
rem this ends the loop
loop"
I wonder where that fish did go, a fish, a fish, a fish, O