System.Net.Sockets

I was trying to get a webserver into my project.
But I have problems with using System.Net.Sockets;
Everytime It give a error.

Somebody know How I can put using System.Net.Sockets; into my progrem.
I also try to at the reference but could not find it

Can you post some of your code so we can see what you are trying to do?

What is the error you are getting?

Please post more info:
Hardware (Board, NW Module, …)
FW Version
Code

Here is my code.
The only error it gives is thet Sockets doesn’t excist in System.net
I use the Fez cobra and version 4.1

Program.cs

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using GHIElectronics.NETMF.Hardware;
using GHIGraphicalDemo.Presentation;
//using GHIElectronics.NETMF.FEZ;
namespace GHIGraphicalDemo
{
public class Program : Application
{
public static Program program;

    public static void Main()
    {

Bitmap logo = Resources.GetBitmap(Resources.BitmapResources.ThomasMore_logo);
Configuration.StartUpLogo.Set(logo.GetBitmap(), (SystemMetrics.ScreenWidth - logo.Width ) / 2, (SystemMetrics.ScreenHeight - logo.Height) / 2);

        Program program = new Program();    

        // Enable touch
        Touch.Initialize(program);
        TouchCollectorConfiguration.CollectionMethod = CollectionMethod.Native;
        TouchCollectorConfiguration.CollectionMode = CollectionMode.InkAndGesture;

        // Note, this is the amount of time (in ms) to elapse before sending a move event.
        TouchCollectorConfiguration.TouchMoveFrequency = 100; // 10 events a second times a second

        TestWindow currentWindow = new TestWindow(program);

        // Start the application.
        program.Run(currentWindow);
    }
}

}

-------------------------------------------------------------------------------------------------------------------------And then the window with the code to read the sensor:

using System;
using System.IO.Ports;
using System.Text;
using System.Threading;
using System.Net;
using System.Net.Sockets;
using System.Text;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.FEZ;

namespace GHIGraphicalDemo.Presentation
{
public class TestWindow : Window
{

    private Program _program;

    private string temper1 = "Temperatuur 1: ";
    private string temper2 = "Temperatuur 2: ";
    private byte[] adress = new byte[8];
    private ushort temperatuur;

    private static OneWire ow = new OneWire((Cpu.Pin)FEZ_Pin.Digital.IO21);

    private byte[] conT = new byte[1];
    private byte[] readrom = new byte[1];
    private byte[] rx = new byte[2];
  

    private Bitmap screen = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);


    private Font ninaBFont = Resources.GetFont(Resources.FontResources.NinaB);
    private Font smallFont = Resources.GetFont(Resources.FontResources.small);


    private string[] lines = new string[12];

    public TestWindow(Program program)
    {
        _program = program;

        while (true)
        {

            ow.Reset();                   //temperatuur converteren

            ow.WriteByte(0xCC);
            ow.WriteByte(0x44);
            while (ow.ReadByte() == 0) ;
            ow.Reset();
            if (adress[0] == 0)
                ow.Search_GetNextDevice(adress);
            ow.Reset();

            ow.Search_IsDevicePresent(adress);
            ow.WriteByte(0xbe);
            temperatuur = ow.ReadByte();
            temperatuur |= (ushort)(ow.ReadByte() << 8);
            temper1 = ("Temperatuur 1 :" + temperatuur / 16 + " °C");

            ow.Search_GetNextDevice(adress);
            ow.Reset();
            ow.Search_IsDevicePresent(adress);
            ow.WriteByte(0xbe);
            temperatuur = ow.ReadByte();
            temperatuur |= (ushort)(ow.ReadByte() << 8);
            temper2 = ("Temperatuur 2 :" + temperatuur / 16 + " °C");



            DrawSettings();
        }
    }

    public override void OnRender(DrawingContext dc)
    {
        dc.DrawImage(screen, 0, 0);
    }

    private void DrawSettings()
    {
        screen.Clear();
        screen.DrawText("Temperatuur in de kelder:", ninaBFont, Colors.Yellow, 8, 5);

        //Text
        //screen.DrawText(matchStr, ninaBFont, Colors.Yellow, 230, 65);
        screen.DrawText(temper1, ninaBFont, Colors.Red, 5, 100);
        screen.DrawText(temper2, ninaBFont, Colors.Red, 5, 150);
        screen.DrawText("Project pelletkachel KLIM & ELO", ninaBFont, Colors.White, 5, screen.Height - 15);

        screen.Flush();
    }

}

}

1st: is there a reason you still use FW 4.1?
2nd:
which references have you added to your project.
Some of the namespaces are separated into multiple dll’s.
Some of them are called Microsoft.SPOT…
others only System…

In 4.2 ther are for example:
Microsoft.SPOT.Net
Microsoft.SPOT.Net.Security
and
System.Net.Security

Adding one of them to the references will give you the System.Net namespace, but not necessarily the System.Net.Socket class.

@ serneels - Add System.dll to the References

Thanks! I added the System.dll and the error went gone :slight_smile: