
-----------------------------------
Sean
Wed Mar 19, 2008 3:02 pm

Net. Functions
-----------------------------------
With the Net functions built into Turing, there is a Chat program available.

Regarding the program, I was wondering if it is possible to have more then two users talking at once, and have a large group instead?

I have chatted before with another person, running my client in a .t format, while having the server in an .exe format. If possible, how would I be able to open it up for more then two people?

Or is it scripted already to allow them to join?

-----------------------------------
Dan
Wed Mar 19, 2008 6:15 pm

RE:Net. Functions
-----------------------------------
I am not sure witch example or chat program you are talking about, however it is deftaly posible to have mulity user chat in turing.

You need to have a server that gets messages from the clients and then relays it to each client (other then the one that sent it). The server also has to wait for new connections witch means you might need to use processes to deal with the blocking functions.

-----------------------------------
Sean
Wed Mar 19, 2008 6:23 pm

Re: Net. Functions
-----------------------------------

% The "Chat" program
        const chatPort : int := 5055
        var choice : int
        loop
            put "Enter 1 to run chat server"
            put "Enter 2 to run chat session"
            put "Choice: " ..
            get choice
            exit when choice = 1 or choice = 2
        end loop
        var netStream : int
        var netAddress : string
        
        if choice = 1 then
            netStream := Net.WaitForConnection (chatPort, netAddress)
        else
            put "Enter the address to connect to: " ..
            get netAddress
            netStream := Net.OpenConnection (netAddress, chatPort)
            if netStream 