[Release] Create your own base

07/30/2011 01:18 Spirited#1
Hey. This was a requested tutorial. Nothing special really.
He wanted it to be called "educational source". See attached.
07/30/2011 03:58 Y u k i#2
Lol. Seriously? Thats it?
Lemme guess... Erik wanted that XD
07/30/2011 06:08 Spirited#3
Quote:
Originally Posted by Y u k i View Post
Lol. Seriously? Thats it?
Lemme guess... Erik wanted that XD
Hahaha, nah. I don't know his real name but it's not the Eric we know.
Basically, he wanted to know how to get started.
07/30/2011 08:25 GRASSHOPPA#4
Even though this is super tiny and all I honestly still like it
I like that you commented exactly what to do but left it to the person to actually get it done..I'm sure anybody that uses this will like that

Off Topic..
I just saw drunk hobos fighting at a sonic =D
07/30/2011 09:10 BaussHacker#5
And I thought my source I made from scratch was a base :O
07/30/2011 11:51 bodayo69#6
Quote:
Originally Posted by Y u k i View Post
Lol. Seriously? Thats it?
Lemme guess... Erik wanted that XD
What is your problem ? I wanted it and Fang gave me !
07/30/2011 15:05 bodayo69#7
xD!
07/31/2011 00:41 _DreadNought_#8
Here's one void.
Code:
        public DotNetSocket(ushort port)
        {
            _connection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            _connection.Bind(new IPEndPoint(IPAddress.Any, port));
        }
Just wanted to share. Got bored and made that small code.

#edit
Im bored, yes.

And i'm learning too! I've never really worked with socket classes, just used pre-made ones.

Fang,
I assume this is right for the start of the Connect void?
Code:
        public void Connect(IAsyncResult result)
        {
            Wrapper _w = new Wrapper();
            _w.Socket = _connection;
            _connection.Accept();
            ClientConnect.Invoke(_w);
?
07/31/2011 01:18 Spirited#9
Quote:
Originally Posted by _DreadNought_ View Post
Here's one void.
Code:
        public DotNetSocket(ushort port)
        {
            _connection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            _connection.Bind(new IPEndPoint(IPAddress.Any, port));
        }
Just wanted to share. Got bored and made that small code.

#edit
Im bored, yes.

And i'm learning too! I've never really worked with socket classes, just used pre-made ones.

Fang,
I assume this is right for the start of the Connect void?
Code:
        public void Connect(IAsyncResult result)
        {
            Wrapper _w = new Wrapper();
            _w.Socket = _connection;
            _connection.Accept();
            ClientConnect.Invoke(_w);
?
Not quite. Read the comments that I put in there. You don't want to set the server's socket to the client's personal socket.
07/31/2011 02:04 _DreadNought_#10
You want to create a new instance :)
07/31/2011 02:12 Spirited#11
Quote:
Originally Posted by _DreadNought_ View Post
You want to create a new instance :)
Drifting further away... lol
My comments should tell you everything that you need to figure it out.
07/31/2011 11:30 _DreadNought_#12
Sorry was half asleep at 1am :)
I took one look and done it
Code:
            Wrapper _w = new Wrapper();
            _w.Socket = _connection.EndAccept(result);
            _w.Socket.BeginAccept(Connect, new AsyncCallback(Receive));
            ClientConnect.Invoke(_w);
most of that function.
07/31/2011 20:03 Spirited#13
Quote:
Originally Posted by _DreadNought_ View Post
Sorry was half asleep at 1am :)
I took one look and done it
Code:
            Wrapper _w = new Wrapper();
            _w.Socket = _connection.EndAccept(result);
            _w.Socket.BeginAccept(Connect, new AsyncCallback(Receive));
            ClientConnect.Invoke(_w);
most of that function.
Good job. =p You might want to put some checks on that to make sure that the client's socket isn't null.

PS: Don't check to see if it's Connected (that takes longer in ms).
09/06/2012 16:45 noblewarrior#14
Wow, I can't believe I'm only finding this now o_0
Thank you Fang for doing this! I've been trying to learn how sockets work and this has helped me to understand!

Thanks again!
noblewarrior.
09/06/2012 19:13 ImFlamedCOD#15
Not to shabby, still I think between all the releases with the use of the search button anyone would find, many c# bases, even a c++ base to use as a starting point.

Kudo's to you sir for helping out the juniors. And good luck to ya'll.