请问一下C#用以太网访问PLC的源码

请教一下C#用以太网访问PLC的源码
谁有C#用以太网访问PLC的源码 不需要详细,有个概念框架的源码给我就好了,万分感谢了!!!
我的邮箱a306843202@163.com,很想学习,在线等,大侠来吧!!!!请问一下C#用以太网访问PLC的源码
------解决方案--------------------
标准的TCP访问,跟PC之间访问没有区别。
------解决方案--------------------
1.建立Socket通信 IpAddr Port
2.读写送信,结果受信。
具体的还是要看你用的是那家的PLC,通信协议是什么

------解决方案--------------------
http://forums.mrplc.com/index.php?app=downloads&showfile=1000
------解决方案--------------------
和你的PLC不一样,都Mitsumishi的

都是通过Socket给PLC发消息,然后读取返回


protected void Write(byte[] sendBuffer)
        {
            //TCPクライアントが接続されていない場合は、接続する 
            if (_socket == null 
------解决方案--------------------
 !_socket.Connected)
            {
                if (_logs != null) _logs.WriteT(GetType().Name, MethodBase.GetCurrentMethod().Name, "Connect");
                Connect();
            }

            _socket.Send(sendBuffer);
        }

        /// <summary>
        /// PLCから返信データを受信する
        /// </summary>
        /// <param name="recvBuffer">受信バッファ
        /// 異常のときは、Length=0で返す</param>
        protected void Read(out byte[] recvBuffer)
        {
                recvBuffer = new byte[0];

                //1回目の読出:応答データ長まで
                byte[] buf = new byte[RES_DATA_LENGTH_READ_COUNT];
                //int readBytes = _stream.Read(buf, 0, buf.Length);
                int readBytes = Read(buf, 0, buf.Length);

                //// readBytes != resDataLength のときは例外が発生するので、コメントアウト
                ////if (readBytes == buf.Length)
                ////{

                ushort resDataLength = (ushort)BinaryConvert.ConvByteToShort(buf[IDX_OF_RES_DATA_LENGTH], buf[IDX_OF_RES_DATA_LENGTH + 1]);

                //2回目の読出:応答データ長で指定されたバイト数読出
                if (resDataLength > 0)
                {
                    readBytes = 0;

                    //読出バッファのサイズを全応答データ長にする
                    Array.Resize(ref buf, buf.Length + resDataLength);

                    //応答データ長の次のインデックスから受信データを格納
                    ////readBytes = _stream.Read(buf, RES_DATA_LENGTH_READ_COUNT, resDataLength);
                    readBytes = Read(buf, RES_DATA_LENGTH_READ_COUNT, resDataLength);
                    recvBuffer = buf;
                }
                else
                {
                    if (_logs != null) _logs.WriteErr(enmErrCodeFlag.Warning, GetType().Name, MethodBase.GetCurrentMethod().Name, "resDataLength:" + resDataLength.ToString());