Check Out Dave's New game for iPhone and iPod Touch: Smiled Out!

Chat Client/Server Part 1: Network Programming Primer and Packet Base Class

Pages: 1 2 3 4 5 6 7

Well, that was the hard part. The theory and the base class are the tough ideas to present. In the next part of this tutorial I will implement with you a “ChatPacket” which will use the Packet base class, as well as a “Connection” class which will implement sending and receiving of packets.

After that we will write our server program, followed by our chat client software. By that time, you should be pretty good at sending and receiving network data with the Dot Net Framework!

To recap, here is the complete code listing of Packet.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Chat
{
    public abstract class Packet
    {
        protected int _packetTypeCode = 0;
        public int PacketTypeCode { get { return _packetTypeCode; } }
 
        public abstract byte[] ToByteArray();
 
        public static void Parse(byte[] packetData)
        {
        }
    }
}

Look forward to the next parts, coming soon!

Pages: 1 2 3 4 5 6 7


Follow Dave on Twitter
  1. [...] See the original post here: Program With Dave » Blog Archive » Chat Client/Server Part 1 … [...]

  2. [...] the original post:  Program With Dave » Blog Archive » Chat Client/Server Part 1 … By admin | category: chat software | tags: dot-net, manifest-itself, p2p-video, result, [...]

  3. [...] Address Already In Use: JVM_Bind:8080″. Now, if you’ve read my sockets tutorial network primer, you know that a port can only be bound for listening once. So apparently I had another process on [...]

  4. [...] you have not read Part 1 of this Multi-Post tutorial, check it out now. This tutorial will rely on the code written in that [...]

  5. [...] you have not read Part 1 and Part 2 of this network tutorial series, please do so now. The code in this post will build upon [...]

Leave a Reply