// System.Net.Sockets.TcpClientTest.cs
//
// Authors:
// Phillip Pearson (pp@myelin.co.nz)
// Martin Willemoes Hansen (mwh@sysrq.dk)
//
// (C) Copyright 2001 Phillip Pearson (http://www.myelin.co.nz)
// (C) Copyright 2003 Martin Willemoes Hansen
//
using System;
using System.Net;
using System.Net.Sockets;
using NUnit.Framework;
namespace MonoTests.System.Net.Sockets
{
///
/// Tests System.Net.Sockets.TcpClient
///
[TestFixture]
public class TcpClientTest
{
///
/// Tests the TcpClient object
/// (from System.Net.Sockets)
///
[Test]
public void TcpClient()
{
// set up a listening Socket
Socket lSock = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
lSock.Bind(new IPEndPoint(IPAddress.Any, 8765));
lSock.Listen(-1);
// connect to it with a TcpClient
TcpClient outClient = new TcpClient("localhost", 8765);
Socket inSock = lSock.Accept();
// now try exchanging data
NetworkStream stream = outClient.GetStream();
const int len = 1024;
byte[] outBuf = new Byte[len];
for (int i=0; i