Main Site Documentation

TCP Client sample


#1

Hi
I’ve read about TCP server example in code share :

it contains 2 liberary :


using GHIElectronics.NETMF.Net.Sockets;
using Socket = GHIElectronics.NETMF.Net.Sockets.Socket;

it is strange for me since I can’t see those in my references list!
How can I add them to my project ? (I’m using Raptor mainboard)
Apart from that is there any example about using Ethernet_ENC28 as TCP client ?
thanks


#2

That code example is out of date.

https://www.ghielectronics.com/docs/30/networking


#3

@ Mike - That topic is just about how to start network interface.
I want to know how I can use Socket and bind an IP to it by something like IPEndpoint, then transfer data to a server (my PC)
is there any example?


#4

Just like you would do it in Windows .NET.
There is not really a difference after the interface is initialized:

TCP Client::

var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(new IPEndPoint(IPAddress.Parse("theIP"), daPort));

#5

@ Reinhard Ostermeier - Thank you
Yes I found the assembly is just : system.net.sockets
It’s working :slight_smile: thanks