Computer Science Canada

Chat Program

Author:  Delta [ Fri Mar 21, 2003 10:31 am ]
Post subject:  Chat Program

Here is my chat program I'm not sure if it works over the net but it does work over the network(LAN). I would have made it a excutable but it doesn't work right if I do so. But here it is any ways.

Comments and Suggestions are appreciated.

I wasnt able to test it, but from what I've seen, I looks nice... Giving 10bits - Tony

Author:  Asok [ Fri Mar 21, 2003 11:33 am ]
Post subject: 

hitting cancel ends the program which is rather annoying.

Author:  Delta [ Fri Mar 21, 2003 3:07 pm ]
Post subject:  ...

The only way that it ends is if you hit the exit menu item or yeah the [X] at the top of the window which I couldn't get away from right away but I'm working on it. Smile But in all the windows that pop up there is a cancel/close button, except the host window.

Author:  JayLo [ Fri Mar 21, 2003 6:18 pm ]
Post subject:  another chat program

here's another to add to the bunch.

MOD Edit: Interesting... +10bits -Tony

Author:  Delta [ Fri Mar 21, 2003 6:41 pm ]
Post subject:  ?????

How did you make it so if the [X] in the top was clicked it wouldn't exit the program????????????????

Author:  Tony [ Fri Mar 21, 2003 6:43 pm ]
Post subject: 

I think that when compiling the program, you get an option to NOT allow the user to terminate the program... You need v4.x compiler though Confused

Author:  Delta [ Fri Mar 21, 2003 6:43 pm ]
Post subject:  The Whole chat thing

all you need to start the chat program is not much at all it is pretty much just this .
code:

var stream : int := 0 % Used for sending data
var msgBack : string % The message that gets sent back and forth
var address : string % IP address for each computer
var message : string
var status : int

const PORT := 5555 % Port to connect through

put "What would you like to do?"
put "1:Host"
put "2:Join"

get status

if status = 1 then
    stream := Net.WaitForConnection (PORT, address)
else
    put "What is the IP of the computer you want to connect to?"
    get address
    stream := Net.OpenConnection (address, PORT)
end if
cls
put "Connected to ", address

loop
    if hasch then
        get message : *
        put : stream, message       
    end if
    if Net.LineAvailable (stream) then
        get : stream, msgBack : *
        put msgBack
    end if
end loop

Author:  Tony [ Fri Mar 21, 2003 6:44 pm ]
Post subject: 

hey Delta... rewrite that as a tutorial and I'll give you a bunch of bits for it Wink

Author:  Delta [ Fri Mar 21, 2003 6:49 pm ]
Post subject: 

OK I will rewrite it right now where should I post it? In the tutorials page


: