I created a small client to allow TCP chat.. mainly to play with the idea of chating duting games.
Whilst it is quite a nasty through together code wise. This is my first attempt at anything in Blitz since my days of Stos.
The problems I have is that the client seems to crash when I click away from the window and also if you run the client on seperate machines and not loopback, then it seems unstable.
I know its nasty, but where am I going wrong?
Code===
;
AppTitle "Msg Client V 0.1 - Type exit on cmd Line To quit"
;----------->>set main global variables<<----------
;client variables
Global sendpinger$
Global timer
Global username$
Global otherip$
Global startsession$
Global msgsend$
Global msgreceive$
;server variables
Global connectclient$
Global connecturl1$
Global inputentry$
Global timergap$
Global entryfield$
;misc variables
Global linenumber
;----------->>init and set the pinger/server<<-----------
Graphics 640,260,16,2
linenumber=10
connecturl1$=CreateTCPServer(8080)
username$=Input$("Username: ")
otherip$=Input$("IP: ")
sendpinger$=OpenTCPStream(otherip$,8080)
Cls
.startagain
;If linenumber =230 Then
;linenumber=10
;Cls
;EndIf
Locate 0,240
msgsend$=Input$(">: "):msgsent=1
Cls
If msgsend$="exit" Then End
If msgsent=1
WriteString sendpinger$,"Message: "+msgsend$+" from "+username$
Chr$(10)
msgsent=0
EndIf
;CloseTCPStream = sendpinger$
sendpinger$=OpenTCPStream(otherip$,8080)
connectclient$=AcceptTCPStream(connecturl1$)
If connectclient$ Then
inputentry$=ReadString$ (connectclient$)
Locate 0, linenumber
Print inputentry$+" "+CurrentDate()+" "+CurrentTime$()
; linenumber=linenumber+10
EndIf
Goto startagain
Whilst it is quite a nasty through together code wise. This is my first attempt at anything in Blitz since my days of Stos.
The problems I have is that the client seems to crash when I click away from the window and also if you run the client on seperate machines and not loopback, then it seems unstable.
I know its nasty, but where am I going wrong?
Code===
;
AppTitle "Msg Client V 0.1 - Type exit on cmd Line To quit"
;----------->>set main global variables<<----------
;client variables
Global sendpinger$
Global timer
Global username$
Global otherip$
Global startsession$
Global msgsend$
Global msgreceive$
;server variables
Global connectclient$
Global connecturl1$
Global inputentry$
Global timergap$
Global entryfield$
;misc variables
Global linenumber
;----------->>init and set the pinger/server<<-----------
Graphics 640,260,16,2
linenumber=10
connecturl1$=CreateTCPServer(8080)
username$=Input$("Username: ")
otherip$=Input$("IP: ")
sendpinger$=OpenTCPStream(otherip$,8080)
Cls
.startagain
;If linenumber =230 Then
;linenumber=10
;Cls
;EndIf
Locate 0,240
msgsend$=Input$(">: "):msgsent=1
Cls
If msgsend$="exit" Then End
If msgsent=1
WriteString sendpinger$,"Message: "+msgsend$+" from "+username$
Chr$(10)
msgsent=0
EndIf
;CloseTCPStream = sendpinger$
sendpinger$=OpenTCPStream(otherip$,8080)
connectclient$=AcceptTCPStream(connecturl1$)
If connectclient$ Then
inputentry$=ReadString$ (connectclient$)
Locate 0, linenumber
Print inputentry$+" "+CurrentDate()+" "+CurrentTime$()
; linenumber=linenumber+10
EndIf
Goto startagain