Click here to Skip to main content
15,885,546 members
Articles / Programming Languages / C#

Managed I/O Completion Ports (IOCP)

Rate me:
Please Sign up or sign in to vote.
4.92/5 (76 votes)
26 Apr 200621 min read 418.3K   5.3K   259  
A fully managed .NET implementation of Win32 IOCP's waitable event queuing mechanism.
using System;
using System.Net;
using System.Net.Sockets;

namespace Sonic.Net.Network
{
	/// <summary>
	/// Summary description for SocketClient.
	/// </summary>
	public class SocketClient
	{
		public SocketClient(EndPoint ep)
		{
			_readDataHandler = new AsyncCallback(this.ReadDataHandler);

			Socket s = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.IP);
			s.Connect(ep);
			int sizeToRead = 0;
			byte[] data = GetNextReceiveBuffer(ref sizeToRead);
			s.BeginReceive(data,0,sizeToRead,SocketFlags.Partial,_readDataHandler,this); 
		}

		private void ReadDataHandler(IAsyncResult ar)
		{

		}
		
		private byte[] GetNextReceiveBuffer(ref int sizeToread)
		{
			return null;
		}

		private AsyncCallback _readDataHandler; 
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect
India India
Software Professional with 14+ Years of experience in design & development of server products using Microsoft Technologies.

Woked/Working on server side product development using Managed C++ & C#, including Thread pools, Asynchronous Procedure Calls (APC), Inter Process Communication (IPC) using named pipes, Lock Free data structures in C++ & .Net, etc.

Comments and Discussions