टीसीपी क्लाइंट के साथ करना बहुत आसान है। सर्वर खोलें:
TcpClient tcpClient = new TcpClient();
tcpClient.Connect(POP3Server, POP3Port);
NetworkStream stream = tcpClient.GetStream();
स्वागत संदेश पढ़ें:
int read = stream.Read(inBuffer, 0, inBuffer.Length);
string response = Encoding.ASCII.GetString(inBuffer, 0, read);
if (response.IndexOf("+OK") != 0) throw new ...;
सर्वर पर वापस लिखें:
byte[] outBuffer = Encoding.ASCII.GetBytes("USER " + account + "\r\n");
stream.Write(outBuffer, 0, outBuffer.Length);
वह USER कमांड भेजता है। आपको लॉगिन करने की आवश्यकता है और फिर आप संदेशों को हथियाने शुरू कर सकते हैं - पीओपी 3 आरएफसी देखें आदेशों की पूरी सूची। यदि आप इस CodeProject आलेख को स्वयं जांचना नहीं चाहते हैं।