[C#]Hero v2[SOCKETS]

Status
Not open for further replies.

Dayron1234

Rapnameiszero,cuzIhavezero,toleranceforidiots
Jun 30, 2010
772
35
Hey guy's as you know I was doing another text RPG and released with quite a few feature's but now I'm developing another one with C# still and probably with socket's so you guy's can play online and battle each other.You can see my progress so far below.

Green - Finished
Blue - Working on it
Red - Haven't started

Progress:

  • Sockets
  • Monster's
  • Leveling up
  • Error fixing/Bug fixing

More progress to come!

If you would like to help me with this project or be a beta tester just PM me :)
 

Dayron1234

Rapnameiszero,cuzIhavezero,toleranceforidiots
Jun 30, 2010
772
35
Just started on the new Monster "Wizard" gonna make it so you must have experience 50 to fight him or you will die at level 0 lol
 

Dayron1234

Rapnameiszero,cuzIhavezero,toleranceforidiots
Jun 30, 2010
772
35
Thank's

--UPDATE(S)--

Okay so I'm 99% done with socket's here is my progress so far.

Server:
Code:
using System;
using System.Net.Sockets;

public class AsynchIOServer
{
    public static void RPG()
    {
        TcpListener tcpListener = new TcpListener(10);
        tcpListener.Start();
        Socket socketForClient = tcpListener.AcceptSocket();
        if(socketForClient.Connect)
        {
            Console.WriteLine("Client has connected successfully");
            NetworkStream networkStream = new
            NetworkStream(socketForClient);
            System.IO.StreamWriter streamWriter =
            new System.IO.StreamWriter(networkStream);
            System.IO.StreamReader streamReader =
            new System.IO.StreamReader(networkStream);
            string theString = "Sending";
            streamWriter.WriteLine(theString);
            Console.WriteLine(theString);
            streamWriter.Flush();
            theString = streamReader.ReadLine();
            Console.WriteLine(theString);
            streamReader.Close();
            networkStream.Close();
            streamWriter.Close();
        }
        socketForClient.Close();
        Console.WriteLine("Exiting...");
    }
}

Client:
Code:
using System;
using System.Net.Sockets;

public class Client
{
    static public void RPG(string[] Args)
    {
        TcpClient socketForServer;
        try
        {
            socketForServer = new TcpClient("localhost", 10);
        }
        catch
        {
            Console.WriteLine(
            "Failed to connect to server at {0}:999", "localhost");
            return;
        }
        NetworkStream networkStream = socketForServer.GetStream();
        System.IO.StreamReader streamReader =
        new System.IO.StreamReader(networkStream);
        System.IO.StreamWriter streamWriter =
        new System.IO.StreamWriter(networkStream);
        try
        {
            string outputString;
            // read the data from the host and display it
            {
                outputString = streamReader.ReadLine();
                Console.WriteLine(outputString);
                streamWriter.WriteLine("Client Message");
                Console.WriteLine("Client Message");
                streamWriter.Flush();
            }
        }
        catch
        {
            Console.WriteLine("Exception reading from Server");
        }
        // tidy up
        networkStream.Close();
    }
}
 

Dayron1234

Rapnameiszero,cuzIhavezero,toleranceforidiots
Jun 30, 2010
772
35
Looking pretty much the same all that was done to it was added Online option so once you hit that option I'm gonna make it so it will open the Online server or Client to connect to.

--UPDATE--

Just got the socket's to kinda work? it will open in a new command prompt and say "Waiting for a connect" So I'm assuming that it is 99.5% complete so I might get to to work soon!
 
Status
Not open for further replies.

Users who are viewing this thread

Top