Here's the code for a basic chat. After playing with this a bit to get a feel of how it works, I suggest you read the reference manual thoroughly to allow you to detect new connections, match connections to names etc.
Limitations:
One-to-one only - you'll need to change it if you want more.
No local echoing of keypresses - you need to arrange separate areas of the display for remote and local users - all up to you

Keypresses are sent immediately - In the real world, you'll buffer all local keypresses until the user presses the ENTER key to send - again, it's all yours.
Load the code into the editor, set to a 480x360 windowed mode, and run twice.
In the first window, enter 'Y' to be the server, and an IP address of 127.0.0.1 (local to your machine). In the second window, enter 'N' and the same IP.
Hit F12 to exit the app. Good luck, and enjoy
sync on
sync rate 0
cls
perform checklist for net connections
Connection=SearchChecklist("TCP/IP")
if Connection = 0 then Abort("No TCP/IP connection found");
sync off
input "Enter Y if you want to be the server : ", IsServer$
input "Enter the server IP address : ", IP$
sync on
set net connection Connection, IP$
if lower$(IsServer$) = "y"
create net game "Chat", "Server", 2
print "Ready for connections"
else
perform checklist for net sessions
Session=SearchChecklist("Chat")
if Session = 0 then Abort("Cannot locate Chat on the server")
print "Joining..."
sync
join net game Session, "Client"
print "Connected"
endif
sync
` repeat until f12 is pressed
while scancode() <> 88
KeyPress$=inkey$()
` Avoid key repeats
if LastKey$ <> KeyPress$
` Send the keypress
if KeyPress$ <> "" then send net message string 0, KeyPress$
endif
do
` See if any messages pending
get net message
` Break out of the loop if no messages
if net message exists() < 1 then exit
`Remove string messages - you should cater for all message types here
` whether you expect them or not
select net message type()
case 3
KeyPress$=net message string$()
` Display printable characters immediately
if asc(KeyPress$) >= 32
print KeyPress$;
else
` I'll do the ENTER key for you, but backspace is all yours
if asc(KeyPress$) = 13 then print
endif
endcase
endselect
loop
LastKey$=KeyPress$
sync
endwhile
end
`Search the checklist for a specific search string
function SearchChecklist(Search as string)
local i as integer
local result as integer
result=0
for i=1 to checklist quantity()
if SearchString( checklist string$(i), Search ) then exitfunction i
next i
endfunction result
` Search a string for a specific search string
function SearchString(Source as string, Search as string)
local result as integer
local r as integer
local s as string
result=0
r=len(Source)
while r >= len(Search)
s=left$(right$(Source,r), len(Search))
if s = Search then exitfunction 1
dec r
endwhile
endfunction result
function Abort(prompt as string)
print prompt
sync
sync
wait key
end
endfunction