
Network programming
文章平均质量分 63
EricYeung
这个作者很懒,什么都没留下…
展开
-
detect if a URL is reachable
public static bool URLIsReachable(string strURL) { bool reachable = false; HttpWebRequest request = null; HttpWebResponse response = null;原创 2008-02-15 09:43:00 · 772 阅读 · 0 评论 -
C# asynchronous TcpListener
MyConnection.csusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net.Sockets;using Syste原创 2011-10-02 15:40:04 · 1098 阅读 · 0 评论 -
c++ asio: line-based echo server
#include "stdafx.h"#include #include #include #include using namespace std;using boost::asio::ip::tcp;class session{public: session(boost::asio::io_service& ios): m_socket原创 2009-04-03 19:59:00 · 778 阅读 · 0 评论 -
Handle partial msg received (add size header)
client=========================================================== char buf[4098]; buf[0] = /0; for (int i = 0; i { char temp[10]; sprintf(temp, "%原创 2008-12-23 10:57:00 · 745 阅读 · 0 评论 -
simple multi-thread socket server
// SimpleServer.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include "winsock.h"//#include "afxwin.h"#pragma comment(lib, "ws2_32.lib")c原创 2008-01-11 09:55:00 · 1339 阅读 · 0 评论 -
Simple Winsock select-modal server
void AppMain(int argc, TCHAR* argv[], TCHAR* envp[]){ int PortNo = 12345; SOCKET ListenSock; int Ret = 0; WSAData wsa; if ((Ret = WSAStartup(MAKEWORD(2,0), &wsa)) != 0)原创 2008-03-26 11:22:00 · 681 阅读 · 0 评论 -
CSharp download (html, binary file)
download html : WebRequest/WebResponsedownload bin file: WebClient原创 2008-03-11 09:33:00 · 870 阅读 · 0 评论 -
segmented copy file (for network file transfer resume)
private long SectionedCopy(string srcFile, long startPos, string dstFile, bool sectioned) { byte[] buffer = new byte[1024]; int bytesRead = 0;原创 2008-02-25 14:07:00 · 743 阅读 · 0 评论 -
do not bind 127_0_0_1 in socket server
otherwise the server can not accept any client connection other than 127.0.0.1原创 2008-02-25 14:05:00 · 666 阅读 · 0 评论 -
C# concise asynchronous TcpClient
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net.Sockets;using System.Diagnostics;n原创 2011-10-03 15:35:15 · 689 阅读 · 0 评论