Computer Science Canada Net. Functions |
Author: | Sean [ Wed Mar 19, 2008 3:02 pm ] |
Post subject: | 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? |
Author: | Dan [ Wed Mar 19, 2008 6:15 pm ] |
Post subject: | 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. |
Author: | Sean [ Wed Mar 19, 2008 6:23 pm ] | ||
Post subject: | Re: Net. Functions | ||
Using the example from Turing for my testing right now, I can connect with two people so far, but I believe that a firewall prevented my connection with another. |
Author: | Sean [ Wed Mar 19, 2008 7:49 pm ] |
Post subject: | Re: Net. Functions |
Running it on the same computer, I encountered a problem. Once setting it up as a server, in an exe format. I then proceeded to load the .t format, and join as a client, but to my luck, the server was already a client. Does this mean, I need not be a client to commence communications with others? And why does it display it like this: Quote: S E A N ? I find that rather annoying, having to read up and down, I bet there is a way for me to format it, but I have no idea where to format it from the code mentioned above. |
Author: | agnivohneb [ Thu Mar 20, 2008 8:55 am ] |
Post subject: | RE:Net. Functions |
I have been working on this for some time now. I have decided to take the route dan mentioned but have not had the time to do it. I have made preveus versions all available at http://turingnetchatserver.doesntexist.com/ |
Author: | Sean [ Thu Mar 20, 2008 3:10 pm ] |
Post subject: | Re: Net. Functions |
Thanks for the link, I've downloaded your version. Now, I'm just waiting on someone to connect with. Other then that, it seems to be scripted well, and should do what I wanted. |
Author: | agnivohneb [ Thu Mar 20, 2008 3:53 pm ] |
Post subject: | RE:Net. Functions |
mmmk I'm glad you like it. Like I said I am trying to create a server version but have no time. I might get a chance this weekend. |
Author: | Sean [ Thu Mar 20, 2008 4:14 pm ] |
Post subject: | RE:Net. Functions |
Supposibly Mackie has developed the Grass/Character thing for the chat, like we planned in class one day. We've got to test that out too. |
Author: | agnivohneb [ Mon Mar 24, 2008 3:07 pm ] |
Post subject: | RE:Net. Functions |
I have done it. I did have time this weekend to finish the server. have a look, I posted it on the server. http://turingnetchatserver.doesntexist.com/ |
Author: | blackhacker [ Mon Aug 18, 2008 10:25 am ] |
Post subject: | RE:Net. Functions |
var hostAddr : string := "128.100.5.1" put "The machine name of ", hostAddr, " is ", Net.HostNameFromAddress (hostAddr) |
Author: | DemonWasp [ Mon Aug 18, 2008 11:01 am ] |
Post subject: | RE:Net. Functions |
One of the problems you may encounter in Turing is that once a connection has been formed on a given port, you can no longer listen on that port, as it is "in use". Therefore, if you have a standard port that your client expects to connect to the server on, you have to do some magic. Naive Way (maximum one client, one server): 1. Server listens on port X. 2. Client connects to Server on port X. 3. Server cannot listen on port X again Better Way (no real maximum that you'll run into): 1. Server listens on port X. 2. Client connects to Server on port X. 3. Server says "Y" to Client; Client disconnects from Server and reconnects on port Y (chosen so that the server never selects two Y's the same at the same time). 4. Server listens on port X again, so that more clients can connect on that port. It's not flawless, but it does let you have multiple connections to a "server" in Turing. |