我的文章
http://www.cdd.cn/homepage03/article_show.asp?id=124927&m_id=72648
java 操作 dll JNative LEd – zjutsoft的专栏 – CSDN博客
http://blog.csdn.net/zjutsoft/archive/2009/09/10/4538943.aspx
C# Tutorial – Simple Threaded TCP Server | Switch on the Code
http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server
TcpClient
CodeProject: Multi-threaded .NET TCP Server Examples. Free source code and programming help
http://www.codeproject.com/KB/IP/dotnettcp.aspx
CodeProject: A Simple Multi-Threaded Server Client Instant Messenger Application. Free source code and programming help
http://www.codeproject.com/KB/IP/Instant_Messenger.aspx
TCPClient 多对多聊天 – 天书的博客 – C++博客
http://www.cppblog.com/skybook/archive/2008/11/08/66305.html
TcpListener
一个简单的多线程即时通讯程序(类似QQ,MSN)(2) – 技术应用 – 豆豆网
http://tech.ddvip.com/2008-12/1229588865101065_2.html
用c#实现类似QQ的简单通讯程序__开发编程_网站开发_Asp.Net_中国教学第一门户:学网(Xue163.com),学尽天下知识
http://www.xue163.com/html/2008626/633321.html
发起一个基于.NET的类似QQ的开源项目,请各位高手参加! .NET技术 / .NET Framework – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20040110/09/2651399.html
用c#实现类似QQ的简单通讯程序 – H_J_H – CSDN博客
http://blog.csdn.net/JOHNCOOLS/articles/616162.aspx
CodeProject: Asynchronous socket communication. Free source code and programming help
http://www.codeproject.com/KB/IP/socketsincs.aspx
CodeProject: Picture Chat Using C#. Free source code and programming help
http://www.codeproject.com/KB/IP/ykw1.aspx
CodeProject: Creating a Client – Server app – Making a Chat. Free source code and programming help
http://www.codeproject.com/KB/IP/dotChatNET.aspx
集合已修改;可能无法执行枚举操作怎么解决啊 .NET技术 / ASP.NET – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20060519/10/4763259.html
查询集合已修改;可能无法执行枚举操作 – 明天的明天 永远的永远 未知的一切 我与你一起承担 ?? – 博客园
http://www.cnblogs.com/Fooo/archive/2008/11/11/1331151.html
foreach是取只读的,在取的时候数据不能变(包括修改,删除,添加等)。
要避免这个问题,就应该使用for循环。
//************************************************
问题:在foreach里进行循环row.delete()的是否有时候可以,有时候却不可以会报如下错误:
集合已修改;枚举操作可能无法执行。
经过调试发现问题所在了:foreach里进行循环row.delete()的时候,行的状态必须是Unchanged,才可以的,新增加的行里的状态是Added,然后抛出了刚才说的异常。
所以要使用DataTable的 AcceptChanges() 方法把新增加的行的状态置为Unchanged以确认在DataTable里的更改。然后在循环删除的行的时候Row.elete() ,这些行的状态就被置为Deleted了。不需要删除的行还得通过SetAdded()方法来置回原来的Added状态。 这样在DataAdapter里对数据源进行更新的时候,就可以把新增加的记录更新到数据库里去了。
集合已修改;可能无法执行枚举操作。–同创编程频道
http://www.tctl.com.cn/accp/1490/1492/132252.html
集合已修改;可能无法执行枚举操作 foreach – axislover的日志 – 网易博客
http://axislover.blog.163.com/blog/static/1077651520099299333550/
InvalidOperationException: 集合已修改;可能无法执行枚举操作 – 大尾巴狼专栏 – CSDN博客
http://blog.csdn.net/jjjjj102310253/archive/2008/12/03/3434821.aspx
集合已修改;枚举操作可能无法执行。_.Net教程;C#教程;VB.Net教程;Xml教程;WebService教程;Ajax教程-我爱.Net教程网
http://www.52net.org/html/_Net_kaifayuyan/Asp_Net/20091210/12434.html
C#: How to determine if a TCPClient has been disconnected. – Dev Shed
http://forums.devshed.com/net-development-87/c-how-to-determine-if-a-tcpclient-has-been-disconnected-372557.html
C#: How to determine if a TCPClient has been disconnected.
http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/c857cad5-2eb6-4b6c-b0b5-7f4ce320c5cd
Try this
TcpClient.Connect(….)
GetStream…
(Pull out your network cable…)
if (tcpClient.Connected)
{
bool IsYouConnectionAlright =
tcpClient.client.Poll(01, SelectMode.SelectWrite) &&
tcpClient.client.Poll(01, SelectMode.SelectRead) && !tcpClient.client.Poll(01, SelectMode.SelectError)?true:false;
}
标签:socket
C#处理gif的问题-C# – 开发者
http://www.phpchinaz.cn/c/CSharp/52_5201_1224834355.html
C#实现GIF图片背景图片透明,有高人会吗? – 博问 – 博客园社区
http://space.cnblogs.com/question/442/
怎么用c#读取gif的位图数据? .NET技术 / C# – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20031011/17/2344610.html
如何用Socket实现客户端通信模块
http://www.chinaitpower.com/A/2001-10-11/1436.html
C#实现CMPP3.0 ISMG SP客户端(CMPP SP Client)_极于情,方能极于剑!
http://hi.baidu.com/lingyunj/blog/item/20df42ee6e119ff9b2fb95a3.html
CMPP SP端 C# 实例
http://www.hackhome.com/InfoView/Article_179524_9.html
CMPP SP端 C# 实例2_︶ㄣ我爱我家
http://hi.baidu.com/tiankong912/blog/item/caf3504ede409408b3de05a4.html
中国移动短信网关CMPP3.0 C#源代码:CMPP30类(1)(转) – 9who的程序博客,天道酬勤 – 博客园
http://www.cnblogs.com/9who/archive/2007/09/27/907903.html
中国移动短信网关CMPP3.0 C#源代码:CMPP30类(1) >> 泠云天天在线 ==>> 网络编程、数据库编程、网页制作、建网技术、操作系统、网络安全、软件开发、asp、jsp、mssql、sql server、mysql、oracle、病毒
http://www.lyttzx.com/Article_Show.asp?ArticleId=1147
中国移动短信网关CMPP3.0 C#源代码:CMPP30类(2) >> 泠云天天在线 ==>> 网络编程、数据库编程、网页制作、建网技术、操作系统、网络安全、软件开发、asp、jsp、mssql、sql server、mysql、oracle、病毒
http://www.lyttzx.com/Article_Show.asp?ArticleId=1148
CMPP SP端 C# 实例
http://www.iwms.net/n1223c16.aspx
中国移动短信网关CMPP3.0 C#源代码:使用示例 – 天道酬勤 – 博客园
http://www.cnblogs.com/psdesign/articles/1276199.html
中国移动短信网关CMPP3.0 C#源代码:使用示例 – [木子]的专栏 – CSDNBlog
http://blog.csdn.net/bulbul2006/archive/2006/06/07/777480.aspx
CMPP30 类 – C#,Java—-blog – 博客园
http://www.cnblogs.com/endpoint/archive/2007/01/31/635506.html
NetworkStream
中国移动短信网关CMPP3.0 C#源代码:事件定义及相关工具函数
http://jemmy0327.blogcn.com/diary,205683435.shtml
Monitor.Enter 方法 (System.Threading)
http://msdn.microsoft.com/zh-cn/developercenters/de0542zz.aspx
很菜的问题:Monitor.enter和lock的用法和区别? .NET技术 / C# – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20030617/16/1926284.html
一个简单的C#死锁程序_Asp.net实例教程_Asp.net_网站开发
http://www.diybl.com/course/4_webprogram/asp.net/asp_netshl/20081117/151856.html
Tiray\’s Blog–Life In Blogcn
http://jemmy0327.blogcn.com/diarypage.shtml?sortsid=821113
中国移动短信网关CMPP3.0 C#源代码:CMPP30类(1)
http://jemmy0327.blogcn.com/diary,205684536.shtml
中国移动短信网关CMPP3.0 C#源代码:CMPP30类(2)
http://jemmy0327.blogcn.com/diary,205684844.shtml
中国移动短信网关CMPP3.0 C#源代码:数据包定义
http://jemmy0327.blogcn.com/diary,205683551.shtml
中国移动短信网关CMPP3.0 C#源代码:事件定义及相关工具函数
http://jemmy0327.blogcn.com/diary,205683435.shtml
CSDN技术中心 [C#] NetworkStream.Write()存在严重bug
http://dev.csdn.net/article/83456.shtm
NetworkStream 类—-提供用于网络访问的基础数据流 – 点滴积累,融会贯通 – 博客园
http://www.cnblogs.com/xh831213/archive/2006/02/14/330257.html
完整的TCP通信包实现
http://www.7139.com/jsxy/cxsj/c/200607/114407.html
socket连接中如何检测到远程的客户端socket已断线 .NET技术 / C# – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20021105/10/1149227.html
CodeProject: Multi-threaded .NET TCP Server Examples. Free source code and programming help
http://www.codeproject.com/KB/IP/dotnettcp.aspx
[请教]socket编程中如何检测到客户端强行中止程序? Web 开发 / PHP – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20050627/10/4106798.html
select模型 服务器端如何检测客户端socket是否关闭? VC/MFC / 网络编程 – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20050614/16/4081984.html
如何检测socket的状态? Java / J2SE / 基础类 – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20050418/18/3946877.html
怎样检测SOCKET是否有效? VC/MFC / 网络编程 – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20050923/13/4289360.html
WingIDE的破解_Forrest World
http://hi.baidu.com/forestener/blog/item/d54b1ef02cb745c17931aaee.html
(WPF学习记录)第六章 Dock与Grid – - CSDNBlog
http://blog.csdn.net/changjiangboy/archive/2008/09/16/2934556.aspx
Python — The eric Python IDE_逆水寒
http://hi.baidu.com/shiiuen/blog/item/69d273810b1f7fdebc3e1eed.html
Eric4在Windows下的安装_闲客暇居
http://hi.baidu.com/runningon/blog/item/091dd009c4c80187d1581b05.html
一起学WPF系列(3):窗体 – Robin\’s Space – 博客园
http://www.cnblogs.com/jillzhang/archive/2008/04/05/1138526.html
用C#写的聊天程序,贴出所有的源代码,大家帮忙瞧瞧!_软界知道
http://www.softwelt.com/Know/KnowDetail-3168871.html
CodeProject: LAN Chat Using Multicating. Free source code and programming help
http://69.10.233.10/KB/cs/LanChat.aspx
Can\’t make UdpClient object send and receive broadcast messages – .NET C#
http://bytes.com/forum/thread269735.html
CodeProject: Using TCP/IP or UDP to Communicate with Serialized Objects. Free source code and programming help
http://69.10.233.10/KB/IP/ComctSerializedObjects.aspx
CodeProject: Genesis UDP Server and Client. Free source code and programming help
http://69.10.233.10/KB/IP/Genesis.aspx
CodeProject: Getting active TCP/UDP connections on a box. Free source code and programming help
http://69.10.233.10/KB/IP/iphlpapi.aspx
CodeProject: Testing TCP and UDP socket servers using C# and .NET. Free source code and programming help
http://69.10.233.10/KB/IP/testingsocketservers.aspx
CodeProject: A Chat Application Using Asynchronous UDP sockets. Free source code and programming help
http://69.10.233.10/KB/IP/ChatAppAsynchUDPSocks.aspx
CodeProject: Scalable Server Events with .NET UDP Sockets. Free source code and programming help
http://69.10.233.10/KB/IP/UDP_Events.aspx
CodeProject: TinyUDP – Simple UDP Client/Server Components for .NET. Free source code and programming help
http://69.10.233.10/KB/IP/TinyUDP.aspx
C#使用UDP Client编写聊天程序 – lanwilliam的专栏 – CSDNBlog
http://blog.csdn.net/lanwilliam/archive/2008/05/13/2440635.aspx
Use UdpClient : UdpClient « Network « C# / CSharp Tutorial
http://www.java2s.com/Tutorial/CSharp/0580__Network/UseUdpClient.htm
用C#写的聊天程序,贴出所有的源代码,大家帮忙瞧瞧!_软界知道
http://www.softwelt.com/Know/KnowDetail-3168871.html
CodeProject: An Introduction to Socket Programming in .NET using C#. Free source code and programming help
http://www.codeproject.com/KB/IP/socketsincsharp.aspx
C#通讯编程(整理)附代码大家一定要认真看很长的帖子!…
http://www.bcbbs.net/bbs/topic.aspx?topicid=15602
Best Udp Client : Udp Client : C# / C Sharp examples (example source code) Organized by topic \\ Network
http://www.demo2s.com/Code/CSharp/Network/BestUdpClient.htm
CodeProject: UDP Client and Server and Remote BSOD prank too!. Free source code and programming help
http://69.10.233.10/KB/IP/RBSOD.aspx
C# Home : Multithreaded TCP/UDP Client Server
http://www.csharp-home.com/index/tiki-print_article.php?articleId=158&PHPSESSID=dcc25c27f19fd78f2756797fb00a97ba
Handling Events In C#
http://www.csharphelp.com/archives/archive51.html
CodeProject: Using Events and Delegates in C#. Free source code and programming help
http://www.codeproject.com/KB/cs/events_and_delegate_in_c_.aspx
CodeProject: Step by Step: Event handling in C#. Free source code and programming help
http://69.10.233.10/KB/cs/stepbystepeventsincs.aspx
完整的TCP通信包实现 – .NET专区 – 新云网络
http://www.newasp.net/tech/net/12928.html
TCP通信包使用代码示例
http://www.souzz.net/html/edu/net/net14/9349.html
泉水 – 博客园
http://www.cnblogs.com/jiangxiao/
socket 客户端之间是怎么建立连接?
http://topic.csdn.net/u/20070619/09/899d7e40-c5cc-40b0-8390-8e12df96c125.html
BeginConnect Time out.. : .NET Framework Networking and Communication : .NET Development : MSDN Forums
http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/388bab03-1201-48a6-a932-f02f308c6061/
Help with Socket TimeOut? Possible? Help Please? : .NET Framework Networking and Communication : .NET Development : MSDN Forums
http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/5e1d0ec5-7844-4b27-a786-9c59367898a9/
TcpClient connection timeout : .NET Framework Networking and Communication : .NET Development : MSDN Forums
http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/c8161442-61b5-4840-999b-5bb36bda0b6d/
MySQL Bugs: #25057: Unable to connect to any of the specified MySQL hosts
http://bugs.mysql.com/bug.php?id=25057
a problem about Socket.connect( ) ! – .NET C#
http://bytes.com/forum/thread233605.html
選擇通道
http://technet.microsoft.com/zh-tw/4b3scst2.aspx
让.NET Remoting更快些-IPCChannel的实现_大脚板
http://hi.baidu.com/talent_xiaoqiang/blog/item/0ebfb601e6abc7071d9583a8.html
利用SendMessage实现C#进程间通信?_學習 積累 進步
http://hi.baidu.com/cyap/blog/item/516f3c860243a03a66096e65.html
C#下的进程间的通讯 — 共享内存篇 – 雪后残阳 – CSDNBlog
http://blog.csdn.net/dhz123/archive/2008/07/25/2708883.aspx
C# 下的进程间的通讯 — 发消息篇——奴隶
http://www.x2blog.cn/jinhong618/19231.html
使用微软消息队列实现C#进程间通信–易博客·电脑·网络
http://www.ebok.cn/Operating-System/JinCheng/Windows-Process-32855_3.html
c#中怎样实现进程间通信,如何表示管道、共享内存、消息队列和邮件槽? .NET技术 / C# – 社区 community.csdn.net
http://www.80diy.com/home/20050419/16/3949498.html
C++和C#进程之间通过命名管道通信(上) – 胤 scucyno – 博客园
http://www.cnblogs.com/scucyno/archive/2008/10/16/1313051.html
C++和C#进程之间通过命名管道通信(附源码)—下 – 江南嬉帅的专栏 – CSDNBlog
http://blog.csdn.net/xiongxuanwen/archive/2008/06/18/2561905.aspx
CreateNamedPipe
c++进程和C#进程之间通信的问题
http://topic.csdn.net/u/20080606/09/96404359-6178-4158-9018-245334e838b4.html?1607832060
CodeProject: Inter-Process Communication in .NET Using Named Pipes, Part 1. Free source code and programming help
http://www.codeproject.com/KB/threads/dotnetnamedpipespart1.aspx
CodeProject: One use for Overlapped I/O. Free source code and programming help
http://www.codeproject.com/KB/winsdk/overlappedio.aspx
CreateNamedPipe reference for Network Programming in .NET with C# & Visual Basic .NET (VB.NET)
http://www.webtropy.com/articles/art9-1.asp?f=CreateNamedPipe
CodeProject: Three Ways to Inject Your Code into Another Process. Free source code and programming help
http://www.codeproject.com/KB/threads/winspy.aspx
《XPCOM组件开发》笔记(二) – Phinecos(洞庭散人) – 博客园
http://www.cnblogs.com/phinecos/archive/2008/10/22/1212027.html
在C#中利用Keep-Alive处理Socket网络异常断开的方法 – _任飘伶~个人博客 – 博客园
http://www.cnblogs.com/filamm/articles/1293008.html
在C#中利用Keep-Alive处理Socket网络异常断开的方法_hulu的baidu空间/葫芦的百度空间
http://hi.baidu.com/nthulu/blog/item/bdfa8513263e7f816438db49.html
如何处理socket连接后服务器端或客户端的断开_我的地盘我做主
http://hi.baidu.com/qqtangwj/blog/item/38be2cad77e1060c4b36d63a.html
.Net套接字 实现基于事件通知 – bat800(竹林) 的专栏 – CSDNBlog
http://blog.csdn.net/bat800/archive/2007/05/25/1624945.aspx
Socket 死连接详解-网络编程
http://www.kuqin.com/networkprog/20080316/4623.html
C# 通讯中ReceiveTimeout和SendTimeout的作用 – 蓝精灵 – 网易博客
http://rfqipkh.blog.163.com/blog/static/70947252006111453811459/
Asynchronous Server Socket Example
http://msdn.microsoft.com/en-us/library/fx6588te.aspx
Asynchronous socket server problem – ASP.NET Forums
http://forums.asp.net/t/1302126.aspx
Asynchronous socket server problem – ASP.NET Forums
http://forums.asp.net/t/1302126.aspx
what is the best way to do keep alive socket checking in .NET ? – Stack Overflow
http://stackoverflow.com/questions/169170/what-is-the-best-way-to-do-keep-alive-socket-checking-in-net
public static void SetTcpKeepAlive(Socket socket, uint keepaliveTime, uint keepaliveInterval)
&leftsign;
/* the native structure
struct tcp_keepalive &leftsign;
ULONG onoff;
ULONG keepalivetime;
ULONG keepaliveinterval;
&rightsign;;
*/
// marshal the equivalent of the native structure into a byte array
uint dummy = 0;
byte[] inOptionValues = new byte[Marshal.SizeOf(dummy) * 3];
BitConverter.GetBytes((uint)(keepaliveTime)).CopyTo(inOptionValues, 0);
BitConverter.GetBytes((uint)keepaliveTime).CopyTo(inOptionValues, Marshal.SizeOf(dummy));
BitConverter.GetBytes((uint)keepaliveInterval).CopyTo(inOptionValues, Marshal.SizeOf(dummy) * 2);
// write SIO_VALS to Socket IOControl
socket.IOControl(IOControlCode.KeepAliveValues, inOptionValues, null);
&rightsign;
How to restrict duplicate or jumbled messages – C#
http://www.daniweb.com/forums/thread127253.html
Larry Cleeton\’s Blog
http://blogs.msdn.com/lcleeton/
TCP keepAlive settings problem : .NET Framework Networking and Communication : .NET Development : MSDN Forums
http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/d5b6ae25-eac8-4e3d-9782-53059de04628/
CodeGuru: Asynchronous Socket Programming in C#: Part I
http://www.codeguru.com/csharp/csharp/cs_network/sockets/article.php/c7695
understand KeepAlive issues on Socket programing in C#
http://www.pcreview.co.uk/forums/thread-2898714.php
Using TCP/IP KeepAlive in C#
http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic50221.aspx
反馈: Asynchronous socket connect not working properly in C#
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=332142
对于GX服务不稳定的一点改进尝试[转] – DM应用 – 卫视迷 卫视,DM,共享,GPRS,模块,KEY,欧插,IMG – Powered by Discuz!
http://www.tvrofans.org/viewthread.php?tid=4507
Microsoft .NET Framework SDK Net Classes:用管理代码编写联网应用程序 – 从这里出发,力争做一位新手中的高手….——lxinxuan\’s Blog – 博客园
http://www.cnblogs.com/lxinxuan/archive/2005/06/03/167209.aspx
C#中判断socket是否已断开的方法_小鹏空间
http://hi.baidu.com/iepshen/blog/item/8332b9fcb0ae75fefc037fe0.html
如何处理socket连接后服务器端或客户端的断开_我的地盘我做主
http://hi.baidu.com/qqtangwj/blog/item/38be2cad77e1060c4b36d63a.html
.Net套接字 实现基于事件通知 – bat800(竹林) 的专栏 – CSDNBlog
http://blog.csdn.net/bat800/archive/2007/05/25/1624945.aspx
在C#中,服务器如何判断客户端连接已经关闭_Web之路 – Javascript – 特效&line;标准&line;兼容IE,Firefox&line;asp&line;c#.net&line;PHP&line;数据库&line;网络安全
http://hi.baidu.com/aaxh/blog/item/83b9b5fd83d7881408244d72.html
.NET中Socket编程的简单示例 – 侧身向南边 – 博客园
http://www.cnblogs.com/kissknife/articles/475707.html
CSDN技术中心 TCP存活定时器(TCP Keepalive Timer)
http://dev.csdn.net/article/84901.shtm
CMPP SP端 C# 实例 – shanhe的专栏 – CSDNBlog
http://blog.csdn.net/shanhe/archive/2004/07/19/45383.aspx
CMPP SP端的协议开发 – yexiong – 博客园
http://cnblogs.com/yexiong/articles/115330.aspx
CSDN技术中心 中国移动CMPP3.0协议C#版本
http://dev.csdn.net/develop/article/77/77523.shtm
中国移动短信网关CMPP3.0 C#源代码:使用示例
http://jemmy0327.blogcn.com/diary,205685025.shtml
中国移动短信网关CMPP3.0 C#源代码:事件定义及相关工具函数
http://jemmy0327.blogcn.com/diary,205683435.shtml
CMPP3.0 C#
程式設計俱樂部
http://www.programmer-club.com/pc2020v5/forum/ShowSameTitleN.asp?URL=N&board_pc2020=csharp&id=868
回覆:如何即時主動得知TcpClient是否已經斷線? – 微軟技術社群討論區
http://forums.microsoft.com/MSDN-CHT/ShowPost.aspx?PostID=2756229&SiteID=14
e.NativeErrorCode.Equals(10035)
C# Socket通信4_Asp.net,Database,ERP及MES
http://hi.baidu.com/bob_ares/blog/item/8b05bb0ad768c61f95ca6b3d.html
socket, queue, thread 的問題… – VB2005討論板 – VB研究小站討論區 – Powered by Discuz!
http://www.ncis.com.tw/ncis_bbs/viewthread.php?tid=1337
C# 判断网址是否连接成功(多种都不成功)
http://topic.csdn.net/u/20081021/11/3b0d1ee2-6436-4674-93b7-d874691627c7.html?1055446293
Socket.Connect 方法 (EndPoint) (System.Net.Sockets)
http://msdn.microsoft.com/zh-cn/vstudio/ych8bz3x(VS.80).aspx
C# Socket通信1_Asp.net,Database,ERP及MES
http://hi.baidu.com/bob%5Fares/blog/item/ff1bea5c821db043fbf2c03c.html
C# Socket通信2_Asp.net,Database,ERP及MES
http://hi.baidu.com/bob%5Fares/blog/item/8d21951232d920cec3fd783c.html
C# Socket通信3_Asp.net,Database,ERP及MES
http://hi.baidu.com/bob%5Fares/blog/item/9972d7f227377013b07ec53d.html
[C#通信二]C#.net同步异步SOCKET通讯和多线程总结1_我的空间我作主
http://hi.baidu.com/yisheng163/blog/item/11d1c35cf1483247faf2c014.html
Delphi.ktop討論區 – 使用TCPCLIENT與偵錯模式時,離開程式會出現錯誤視窗
http://delphi.ktop.com.tw/board.php?tid=94525
回覆:如何即時主動得知TcpClient是否已經斷線? – 微軟技術社群討論區
http://forums.microsoft.com/MSDN-CHT/ShowPost.aspx?PostID=2756229&SiteID=14
TIDTCPServer与TIDTCPClient连接,网络中间断线,两端的程序如何实时发现断线了???急
http://topic.csdn.net/u/20071007/09/6e4cc02d-cba8-4403-a027-530a086d6b81.html?1688075155
http://big5.webasp.net/article/17/16513_print.htm
一个关于TcpClient重连出错的奇怪问题,希望高人解答。 .NET技术 / VB.NET – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20061130/12/5196650.html
G
/* Rambling comments… */: Disappointing .Net Sockets article in MSDN Magazine this month
http://www.lenholgate.com/archives/000440.html
CodeProject: Testing TCP and UDP socket servers using C# and .NET. Free source code and programming help
http://www.codeproject.com/KB/IP/testingsocketservers.aspx
观察和理解模糊处理的输出
http://msdn.microsoft.com/zh-cn/ms227212(VS.80).aspx
大家好.谁做过Socket通信这一块.我自己建了个类库.自己感觉就很差.想请高人指点指点. .NET技术 / C# – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20061211/10/5221154.html
c#下的Socket网络通信(类库) (转载) – chenlunpan的个人空间 – ITPUB个人空间 – powered by X-Space
http://space.itpub.net/7380741/viewspace-50965
Mike Woodring\’s .NET Sample Page
http://www.bearcanyon.com/dotnet/#ConnectionLimit
c#socket编程基础 – 一他糊涂 – 博客园
http://www.cnblogs.com/jacktu/archive/2007/11/21/966458.html
C#关机的代码怎样? .NET技术 / C# – CSDN社区 community.csdn.net
http://topic.csdn.net/t/20060225/09/4576395.html
c#关机时提示_百度知道
http://zhidao.baidu.com/question/48204712.html
c#关机 – .net–更高的追求! – 博客园
http://www.cnblogs.com/leewy/articles/52010.html
c#关机时自动退出程序_.Net技术文章_Asp.net_网站开发
http://www.diybl.com/course/4_webprogram/asp.net/netjs/2008823/137205.html
# /// <summary>
# /// 操作系统关闭时,关闭应用程序
# /// </summary>
# /// <param name="m">截获系统消息</param>
# protected override void WndProc(ref Message m)
# &leftsign;
# switch (m.Msg)
# &leftsign;
# case 0×0011://WM_QUERYENDSESSION
# m.Result = (IntPtr)1;
# break;
# default :
# base.WndProc(ref m);
# break;
# &rightsign;
# &rightsign;
20080715 c# socket delegate
http://www.yippeesoft.com
static int listenport = 8000;
Socket clientsocket;
TcpListener listener;
Thread clientservice=null;
private void StartListening()
&leftsign;
listener = new TcpListener(IPAddress.Parse("127.0.0.1"), listenport);
listener.Start();
while (true)
&leftsign;
try
&leftsign;
Socket s = listener.AcceptSocket();
clientsocket = s;
clientservice = new Thread(new ThreadStart(ServiceClient));
clientservice.Start();
//MessageBox.Show(clientservice.ToString());
&rightsign;
catch (Exception e)
&leftsign;
Console.WriteLine(e.ToString());
&rightsign;
&rightsign;
&rightsign;
private void ServiceClient()
&leftsign;
Socket client = clientsocket;
bool keepalive = true;
System.IO.BinaryReader reader = null;
reader = new System.IO.BinaryReader(new NetworkStream(client));
while (keepalive)
&leftsign;
//Byte[] buffer = new Byte[1024];
//client.Receive(buffer);
log("rec:" + BitConverter.ToString(dp.GetBytes()));
log("rec:" + dp.strData);
&rightsign;
&rightsign;
delegate int SetTextCallback(string text);
public int log(string s)
&leftsign;
if (this.txt.InvokeRequired)
&leftsign;
SetTextCallback d = new SetTextCallback(log);
this.Invoke(d, new object[] &leftsign; s &rightsign;);
&rightsign;
else
&leftsign;
txt.Text = DateTime.Now.ToString() + s + "\\r\\n" + txt.Text;
&rightsign;
return 0;
&rightsign;
Thread threadListen=null;
http://www.cnblogs.com/imissherso/archive/2007/01/28/632480.html
线程间操作无效: 从不是创建控件“…”的线程访问它。
http://zhidao.baidu.com/question/56199307.html
c#线程问题:线程间操作无效:从不是创建控件picMonster1的线程访问它InvalidOperationException异常
关于多线程处理–线程切换
http://blog.csdn.net/taoxming/archive/2006/10/11/1330530.aspx
http://hi.baidu.com/84547054/blog/item/dc0077261deeba128a82a1a7.html
Visual C#托管Socket的实现方法(转载)
http://hi.baidu.com/jobsmeng/blog/item/da52b9d9401f842910df9b33.html
C#多线程编程—一个简单的聊天程序(Server)
http://1985wanggang.blog.163.com/blog/static/7763833200781424410226/
unix-C#中间件的通信
http://blog.cnbb.com.cn/outcast/archive/2008/03/02/71524.html
C#中TcpListener类的使用(AcceptTcpClient()方法-MSDN)
http://barton131420.cnblogs.com/archive/2005/12/07/292176.html
细节决定成败:映射枚举
XmlNode node = objTmplt.Attributes["name"];
if (node != null)
styleName = node.Value;
or:
XmlNode node = objTmplt.Attributes["name"];
if (node != null && !string.IsNullOrEmpty(node.Value))
styleName = node.Value
http://www.codeproject.com/KB/cs/xmladapter.aspx
Quick Xml Read and Write Adapters for C#
也谈用反射实现Enum→String映射:一种重视性能的方法
http://www.cnblogs.com/smalldust/archive/2006/04/25/384657.html
http://www.codeproject.com/KB/dotnet/unhandledexceptions.aspx
标签:c++, delegate, socket20080307 windows c socket soap
http://www.yippeesoft.com
arm-elf-gcc -nostartfiles -Wl, -elf2flt -o sockaspx socketaspx.c -I/home/sf/sfsf/uClinux-IST/uClibc/include -L/home/sf/sfsf/uClinux-IST/uClibc/lib -fpermissive /home/sf/sfsf/uClinux-IST/lib/uClibc/lib/crt0.o -lc -lpthread -lm
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#define PORT 5566 /* the port client will be connecting to */
#define MAXDATASIZE 1500 /* max number of bytes we can get at once */
int main(int argc, char *argv[])
&leftsign;
int sockfd, numbytes;
char buf[MAXDATASIZE] ;
char* req="POST /test/websrvtest/s.asmx HTTP/1.1\\r\\n"
"Host: www.yippeesoft.com:5566\\r\\n"
"User-Agent: gSOAP/2.7\\r\\n"
"Content-Type: text/xml; charset=utf-8\\r\\n"
"Content-Length: 481\\r\\n"
"Connection: close\\r\\n"
"SOAPAction: \\"http://tempuri.org/HelloWorld\\"\\r\\n\\r\\n"
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n"
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\\"http://schemas.xmlsoap.org/soap/envelope/\\" xmlns:SOAP-ENC=\\"http://schemas.xmlsoap.org/soap/encoding/\\" xmlns:xsi=\\"http://www.w3.org/2001/XMLSchema-instance\\" xmlns:xsd=\\"http://www.w3.org/2001/XMLSchema\\" xmlns:ns2=\\"http://tempuri.org/Service1Soap\\" xmlns:ns1=\\"http://tempuri.org/\\" xmlns:ns3=\\"
struct hostent *he;
struct sockaddr_in their_addr; /* connector\’s address information */
if(argc != 2)
&leftsign;
fprintf(stderr,"usage: client hostname\\n");
exit(1);
&rightsign;
printf("1\\r\\n");
if((he=gethostbyname(argv[1])) == NULL)
&leftsign;
/* get the host info */
herror("get host by name" ) ;
exit(1);
&rightsign;
printf("2\\r\\n");
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
&leftsign;
perror("socket");
exit(1) ;
&rightsign;
printf("3\\r\\n");
their_addr.sin_family = AF_INET; /* host byte order */
their_addr.sin_port = htons(PORT); /* short, network byte order */
their_addr.sin_addr = *((struct in_addr *)he->h_addr);
bzero(&(their_addr.sin_zero), 8); /* zero the rest of the struct */
printf("4\\r\\n");
if (connect(sockfd, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1)
&leftsign;
perror("connect") ;
exit( 1 ) ;
&rightsign;
printf("5\\r\\n");
if (send(sockfd,req, strlen(req), 0) == -1)
&leftsign;
perror("send error");
close(sockfd);
exit(0);
&rightsign;
printf("6\\r\\n");
numbytes=1;
while(numbytes>0)
&leftsign;
numbytes=recv(sockfd,buf,MAXDATASIZE,0);
if(numbytes>0)
buf[numbytes]=0;
else
buf[0]=0;
printf("\\nReceived bytes:%d\\n",numbytes);
printf("Result:\\n%s",buf);
&rightsign;
printf("7\\r\\n");
buf[numbytes] = \’\\0\’;
printf("Received: %s",buf);
close(sockfd);
printf("8\\r\\n");
return 0;
&rightsign;
20080307 windows c socket soap
http://www.yippeesoft.com
#include "winsock.h"
#include "stdio.h"
#pragma comment(lib,"ws2_32.lib")
#define winsock_version 0×0101
void main()
&leftsign;
//I create C:\\Inetpub\\wwwroot\\test\\test.asp ,start the web service
//start my program, the result is OK.
//If it works,it is written by masterz,otherwise I don\’t know who write it.
SOCKADDR_IN saServer;
LPHOSTENT lphostent;
WSADATA wsadata;
SOCKET hsocket;
int nRet;
const char* host_name="www.yippeesoft.com";
// char* req="POST /test/test.asp HTTP/1.0\\r\\n"
// "From: local\\r\\n"
// "User-Agent: post_test/1.0\\r\\n"
// "Content-Type: application/x-www-form-urlencoded\\r\\n"
// "Content-Length: 20\\r\\n\\r\\n"
// "type=12345&name=aaaa";
// char* req="POST /scbt/jieru.aspx HTTP/1.1\\r\\n"
// "X-Online-Host: www.yippeesoft.com:5566\\r\\n"
// "Accept: */*\\r\\n"
// "Host: www.yippeesoft.com:5566\\r\\n"
// "Content-Length: 144\\r\\n\\r\\n"
// "MS4wMAAgMDAxADExMTExMTExMQAAICAgMDAwMDAwMDAwMDAwMTAwODAyMjExMzMwMDEAICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg";
char* req="POST /test/websrvtest/s.asmx HTTP/1.1\\r\\n"
"Host: www.yippeesoft.com:5566\\r\\n"
"User-Agent: gSOAP/2.7\\r\\n"
"Content-Type: text/xml; charset=utf-8\\r\\n"
"Content-Length: 481\\r\\n"
"Connection: close\\r\\n"
"SOAPAction: \\"http://tempuri.org/HelloWorld\\"\\r\\n\\r\\n"
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n"
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\\"http://schemas.xmlsoap.org/soap/envelope/\\" xmlns:SOAP-ENC=\\"http://schemas.xmlsoap.org/soap/encoding/\\" xmlns:xsi=\\"http://www.w3.org/2001/XMLSchema-instance\\" xmlns:xsd=\\"http://www.w3.org/2001/XMLSchema\\" xmlns:ns2=\\"http://tempuri.org/Service1Soap\\" xmlns:ns1=\\"http://tempuri.org/\\" xmlns:ns3=\\"
char dest[1000];
if(WSAStartup(winsock_version,&wsadata))
printf("can\’t initial socket");
lphostent=gethostbyname(host_name);
if(lphostent==NULL)
printf("lphostent is null");
hsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
saServer.sin_family = AF_INET;
// Use def. now, need to handle general case
saServer.sin_port = htons(5566);
saServer.sin_addr = *((LPIN_ADDR)*lphostent->h_addr_list);
nRet = connect(hsocket, (LPSOCKADDR)&saServer, sizeof(SOCKADDR_IN));
if (nRet == SOCKET_ERROR)
&leftsign;
printf("can\’t connect");
closesocket(hsocket);
return;
&rightsign;
else
printf("connected with %s\\n",host_name);
nRet = send(hsocket, req, strlen(req), 0);
if (nRet == SOCKET_ERROR)
&leftsign;
printf("send() failed");
closesocket(hsocket);
&rightsign;
else
printf("send() OK\\n");
nRet=1;
while(nRet>0)
&leftsign;
nRet=recv(hsocket,(LPSTR)dest,sizeof(dest),0);
if(nRet>0)
dest[nRet]=0;
else
dest[0]=0;
printf("\\nReceived bytes:%d\\n",nRet);
printf("Result:\\n%s",dest);
&rightsign;
&rightsign;
20080307 c socket soap 结果
http://www.yippeesoft.com
connected with www.yippeesoft.com
send() OK
Received bytes:618
Result:
HTTP/1.1 200 OK
Connection: close
Date: Thu, 06 Mar 2008 12:53:03 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 369
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.
xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
" xmlns:xsd="
lns="
</HelloWorldResponse></soap:Body></soap:Envelope>
Received bytes:0
Result:
Received bytes:618
Result:
HTTP/1.1 200 OK
Connection: close
Date: Thu, 06 Mar 2008 13:02:02 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 369
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
Received bytes:0
Result:
7
Received: 8
“““““““““
char* req="POST /test/websrvtest/s.asmx HTTP/1.1\\r\\n"
"Host: www.yippeesoft.com:5566\\r\\n"
"User-Agent: gSOAP/2.7\\r\\n"
"Content-Type: text/xml; charset=utf-8\\r\\n"
"Content-Length: 481\\r\\n"
"Connection: close\\r\\n"
"SOAPAction: \\"http://tempuri.org/HelloWorld\\"\\r\\n\\r\\n"
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n"
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\\"http://schemas.xmlsoap.org/soap/envelope/\\" xmlns:SOAP-ENC=\\"http://schemas.xmlsoap.org/soap/encoding/\\" xmlns:xsi=\\"http://www.w3.org/2001/XMLSchema-instance\\" xmlns:xsd=\\"http://www.w3.org/2001/XMLSchema\\" xmlns:ns2=\\"http://tempuri.org/Service1Soap\\" xmlns:ns1=\\"http://tempuri.org/\\" xmlns:ns3=\\"
20070720 IronPython Silverlight WSADuplicateSocket ICE ACE
http://www.yippeesoft.com
http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=2573
1.1 Production
Release name is required
IronPython v1.1 is a minor update to IronPython including both new functionality as well as a number of targeted bug fixes. The new functionality in v1.1 includes several new modules (array, SHA, MD5, and select), support for XML Doc comments within the help system and _doc_ tags, as well as support for loading cached pre-compiled modules.
http://msdn2.microsoft.com/en-us/asp.net/bb187452.aspx
Silverlight Downloads
http://www.codeproject.com/useritems/Call_ironpython__in_C_.asp
Call ironpython in C#
http://www.fish888.com/IronPython-Net-t123690
用IronPython作为.Net的脚本语言。
http://mail.python.org/pipermail/pythondotnet/2007-June/000619.html
Could you tell me how to call python from c#?
http://lists.ironpython.com/pipermail/users-ironpython.com/2006-August/003139.html
Debugging support PythonEngine
http://blog.bittercoder.com/PermaLink,guid,653e6795-9974-47b7-910e-9e4a2d1b4112.aspx
More IronPython and delegates…
ADO.NET Entity Framework June 2007 CTP
http://www.microsoft.com/downloads/details.aspx?FamilyID=5C12FE07-E646-49C2-887F-8CC070B37247&displaylang=en
This CTP contains updates to the ADO.NET Entity Framework since the Visual Studio Codename "Orcas" Beta 1 release, including changes in Object Services, Query, Entity Client, and the Entity Data Model Wizard in Visual Studio. Some of the new features include IPOCO, detaching from long-running ObjectContext instances, multiple entity sets per type, support for referential integrity constraints, span support, transactions, serialization, no more default constructors in code-generated classes, improvements to stored procedure support, access to the underlying store connection, directory macros in the entity connection string to support hosted scenarios, native SQL read-only views, UNICODE support in Entity SQL, query plan caching, and canonical functions in Entity SQL.
http://msdn2.microsoft.com/en-us/library/aa697427(vs.80).aspx
The ADO.NET Entity Framework Overview
http://www.cnblogs.com/Ring1981/archive/2006/08/21/420550.html
ADO.NET Entity Framework简介
C#与IronPython脚本进行数据交互示例
http://blog.csdn.net/yefanqiu/archive/2007/06/04/1637222.aspx
http://www.rainsts.net/article.asp?id=379
Embedding IronPython
http://www.cnblogs.com/perhaps/archive/2005/12/27/305253.html
不可错过的MSDN TV —— IronPython: Python on the .NET Framework (上)
WSADuplicateSocket()
简述:为一个共享套接口创建一个新的描述字。
#include <winsock2.h>
SOCKET WSAAPI WSADuplicateSocket ( SOCKET s,
WSATASK hTargetTask );
s:指定本地套接口描述字。
hTargetTask:指定使用共享套接口的目标任务的句柄。
返回值:
若无错误发生,WSADuplicateSocket()返回新的套接口描述字。否则的话,将返回INVALID_SOCKET错误,应用程序可通过WSAGetLastError()来获取相应的错误代码。
错误代码:
WSANOTINITIALISED 在调用本API之前应成功调用WSAStartup()。
WSAENETDOWN 网络子系统失效。
WSAEINVAL 参数中有非法值。
WSAEINPROGRESS 一个阻塞的WinSock调用正在进行中,或者服务提供者仍在处理一个回调函数
WSAEMFILE 无可用套接口描述字。
WSAENOBUFS 无可用缓冲区空间,套接口未创建。
WSAENOTSOCK 描述字不是一个套接口。
给个delphi的例子
// 发送方
New(lpProtocolInfo);
if WSADuplicateSocket(Session.s,WokeModeRec^.mProcessID,lpProtocolInfo)<>SOCKET_ERROR then
begin
Getmem(CopyData,sizeof(TCOPYDATASTRUCT));
CopyData.dwData:=2; // 文字消息
CopyData.cbData:=SizeOf(lpProtocolInfo^);
CopyData.lpData:=lpProtocolInfo;
Sendmessage(WokeModeRec^.mMainHandel,
WM_COPYDATA,
0,
LPARAM(CopyData));
FreeMem(CopyData);
end;
Dispose(lpProtocolInfo);
// 接收方
GetMem(pData,PCOPYDATASTRUCT(Msg.LParam)^.cbData);
CopyMemory(lpProtocolInfo,PCOPYDATASTRUCT(Msg.LParam)^.lpData,PCOPYDATASTRUCT(Msg.LParam)^.cbData);
FShareSocket := WSASocket(AF_INET, SOCK_STREAM, IPPROTO_IP, lpProtocolInfo, 0, WSA_FLAG_OVERLAPPED);
if (INVALID_SOCKET = FShareSocket) then
begin
Raise Exception.CreateFmt(\’%d\’,[WSAGetLastError]);
WSACleanup();
end;
FreeMem(pData);
ICE和ACE拿在一起比较不合适,他们的目标都不一样,ICE还是和SOAP之类的东西比较吧。
网络性能当然是ACE好,ICE的强项是RPC,也就是说它实现了一个协议+运行时,而且跨平台跨语言,比起CORBA来说,ICE不知道轻了多少。
如果是写一些网络性能要求较高的C/S程序,我觉得还是ACE合适,毕竟还可以选择各种网络模型。如果编写服务,还是选ICE吧,特别是3.0还支持网格。java环境下我比较过SOAP和ICE的性能,同样一个登录服务,ICE一秒钟强调用300次,SOAP只调用了40次。
分布式中间件开发VS分布式开发之ACE
2006-08-24 15:39
ICE(Internet Communications Engine)是ZeroC提供的一款高性能的中间件,基于ICE可以实现电信级的解决方案。前面我们提到过在设计网站架构的时候可以使用ICE实现对网站应用的基础对象操作,将基础对象操作和数据库操作封装在这一层,在业务逻辑层以及表现层(java,php,.net,python)进行更丰富的表现与操作,从而实现比较好的架构。基于ICE的数据层可以在未来方便的进行扩展。ICE支持分布式的部署管理,消息中间件,以及网格计算等等。
不同平台之间互操作的利器–ice
ice是目前非常流行的分布式技术。虽然不是国际标准,虽然它只是由一家不到100人的小公司开发,但是其应用的广泛却令人惊讶。
ice的开发者,有多名corba标准小组的专家,因为不满corba越来越复杂的臃肿架构,而开发了ice协议。
ice功能非常强大,可以用于一台机器上不同进程的通讯,也可以用于一个集群。但是体积却异常小巧,安装包不到20M。
学习ice非常简单,一个小时的时间,就可以令你掌握它的编写和配置。
ice支持多种编程语言,从c++到java,c#,delphi,几乎所有的主流编程语言,都可以使用ice。
ice是我所知道的分布式技术中最易于学习的一种。几乎是傻瓜式的。可以说,用分布式技术,从来没有这么爽过。
ice只要用其接口定义语言定义好一个接口,然后用ice的slice工具生成存根和代理,然后分别实现,就可以用了。
这种接口定义语言非常简单,类似于java的语法,不需要什么解释,一看就懂。
定义好接口以后把它保存成一个xxxxxx.ice文件,然后用ice的工具slice2xx.exe,可以生成存根和代理的声明文件。xx是你要生成的语言的缩写。比如要生成c#的声明,就用slice2cs.exe。
可以用任何语言来实现其存根和代理。
比如,可以用c#实现代理,而用java实现其存根,这样,c#就可以调用java编写的程序。
ice除了要设置一下几个简单的配置信息之外(如对象名,服务器地址,端口),不需要写任何多余的代码。你只要写你实现的那部分就可以了。
ice的官方地址是:
http://www.zeroc.com
目前版本是3.1。下载时可以下载一下ice的文档,里面有ice的示例。
google也可以搜索到很多ice的例子。
ACE主要提供跨平台、可移植的基础实现(OS Adaptive Layer),并且通过一些OO framework、并发通信软件的设计模式来简化开发者的开发,提供高层抽象接口;而ICE中则可处处看到CORBA的影子,完全可理解为ICE是其作者不满意CORBA臃肿、庞大的规范而制定的类CORBA的简约实现,为什么这么说呢?后续将给出概述。因而,ICE和ACE并不是一个层次的东西,若要相比,ICE应该和ICE中的TAO进行比较,TAO是基于ACE框架组件和设计模式构建的、遵循标准的OMG CORBA规范和参考模型实现。
标签:ironpython, python, silverlight, socket20070606 php socket
http://www.yippeesoft.com
活见鬼,用 Monitor Apache Servers 重启APACHE居然不能把PHP.INI里面的配置生效
必须进入管理重启
如何让php5显示错误信息
作者:MKD 日期:2006-12-05
字体大小: 小 中 大
php5默认是关闭错误信息的,一遇到出错,就显示空白页;如果这个网站正在运行,这样做是安全的;但作为一个开发者,则需要查看错误信息,便于调试页面;
解决方法:
打开php.ini文件,356行display_errors = Off(本人为php5版本)
改为display_errors = On
重启IIS服务
php_sockets.dll
socket_create() 不能用
PHP Fatal error: Call to undefined function socket_create() in F:\\php\\send2.php
1 如果網頁出現下列資訊
Fatal error: Call to undefined function: xml_parser_create() in /var/www/localhost/htdocs/cacti/lib/xml.php on line 31
編輯下列檔案增加相關資訊
#nano -w /etc/portage/package.use
=dev-lang/php-4* cgi force-cgi-redirect xmlrpc expat apache2 mysql
emerge -N –newuse =dev-lang/php-4*
Save&exit
重新安裝php4
#emerge =dev-lang/php-4*
筆者在這建議安裝PHP4 因為PHP5問題較多
PHP使用Berkley的socket库来创建它的连接。你可以知道socket只不过是一个数据结构。你使用这个socket数据结构去开始一个客户端和服务器之间的会话。这个服务器是一直在监听准备产生一个新的会话。当一个客户端连接服务器,它就打开服务器正在进行监听的一个端口进行会话。这时,服务器端接受客户端的连接请求,那么就进行一次循环。现在这个客户端就能够发送信息到服务器,服务器也能发送信息给客户端。
产生一个Socket,你需要三个变量:一个协议、一个socket类型和一个公共协议类型。产生一个socket有三种协议供选择,继续看下面的内容来获取详细的协议内容。
定义一个公共的协议类型是进行连接一个必不可少的元素。下面的表我们看看有那些公共的协议类型。
表一:协议
名字/常量 描述
AF_INET 这是大多数用来产生socket的协议,使用TCP或UDP来传输,用在IPv4的地址
AF_INET6 与上面类似,不过是来用在IPv6的地址
AF_UNIX 本地协议,使用在Unix和Linux系统上,它很少使用,一般都是当客户端和服务器在同一台及其上的时候使用
表二:Socket类型
名字/常量 描述
SOCK_STREAM 这个协议是按照顺序的、可靠的、数据完整的基于字节流的连接。这是一个使用最多的socket类型,这个socket是使用TCP来进行传输。
SOCK_DGRAM 这个协议是无连接的、固定长度的传输调用。该协议是不可靠的,使用UDP来进行它的连接。
SOCK_SEQPACKET 这个协议是双线路的、可靠的连接,发送固定长度的数据包进行传输。必须把这个包完整的接受才能进行读取。
SOCK_RAW 这个socket类型提供单一的网络访问,这个socket类型使用ICMP公共协议。(ping、traceroute使用该协议)
SOCK_RDM 这个类型是很少使用的,在大部分的操作系统上没有实现,它是提供给数据链路层使用,不保证数据包的顺序
表三:公共协议
名字/常量 描述
ICMP 互联网控制消息协议,主要使用在网关和主机上,用来检查网络状况和报告错误信息
UDP 用户数据报文协议,它是一个无连接,不可靠的传输协议
TCP 传输控制协议,这是一个使用最多的可靠的公共协议,它能保证数据包能够到达接受者那儿,如果在传输过程中发生错误,那么它将重新发送出错数据包。
现在你知道了产生一个socket的三个元素,那么我们就在php中使用socket_create()函数来产生一个socket。这个 socket_create()函数需要三个参数:一个协议、一个socket类型、一个公共协议。socket_create()函数运行成功返回一个包含socket的资源类型,如果没有成功则返回false。
Resourece socket_create(int protocol, int socketType, int commonProtocol);
现在你产生一个socket,然后呢?php提供了几个操纵socket的函数。你能够绑定socket到一个IP,监听一个socket的通信,接受一个socket;现在我们来看一个例子,了解函数是如何产生、接受和监听一个socket。
<?php
$commonProtocol = getprotobyname(“tcp”);
$socket = socket_create(AF_INET, SOCK_STREAM, $commonProtocol);
socket_bind($socket, ‘localhost’, 1337);
socket_listen($socket);
// More socket functionality to come
?>
<?php
$server_ip="128.168.10.1";
$port = 8888;
echo "0";
if (($sock = socket_create(AF_INET,SOCK_STREAM,SOL_TCP)) < 0) &leftsign;
echo "socket_create() failed: reason: " . socket_strerror($sock) . "\\n";
&rightsign;
$sock=socket_create(AF_INET,SOCK_DGRAM,0);
echo "1";
if(!$sock)&leftsign;
echo "socket create failure";
&rightsign;
echo "2";
$buf="hello,how are you!\\n";
if(!@socket_sendto($sock,$buf,strlen($buf),0,"127.0.0.1",5566))&leftsign;
echo "send error\\n";
socket_close($sock);
exit();
&rightsign;
exit();
$buf="";
$msg="";
if(!@socket_recvfrom($sock,$msg,256,0,&$server_ip,&$port))&leftsign;
echo "recvieve error!";
socket_close($sock);
exit();
&rightsign;
echo trim($msg)."\\n";
socket_close($sock);
?>
标签:php, socket1229 UDP CAsyncSocket
Sending & Receiving UDP Datagrams with MFC\’s CAsyncSocket C++ class
By .
A simple example to show the the use of the MFC CAsyncSocket class to send and received UDP datagrams
Introduction
The following code is intended to provide a very simple example of how to use Microsoft MFC’s CAsyncSocket class to send and receive UDP datagrams.
I was unable to find a simple example of how to use CAsynSocket to send & receive UDP datagrams, so I created my own. I thought others might find it useful. The example shown creates two independent send sockets & a single receiver socket, that will receive data from both senders.
Using the code
To reduce clutter, I have:
included only code relevant to the UDP communications (all socket class code is include, much application code is not).
created separate classes to deal with sending UDP & receiving UDP
The code snippets of my test applications main dialog, <code>UdpTestAppDlg</code> (.cpp & .h), show how to use the simple <code>UdpReceiveSocket</code> & <code>UdpSendSocket</code> classes that I have provide here. The example code shown creates two independent send sockets & a single receiver socket. The receive socket will receive datagrams from both senders.
The rudimentary error handling that is included is sufficient to highlight the commonest socket problems.
———————————————————————————————————————————
// Receiving Socket Class definition
#pragma once
#include <afxtempl.h>
// UdpReceiveSocket command target
class UdpReceiveSocket : public CAsyncSocket
&leftsign;
void OnReceive(int nErrorCode);
public:
UdpReceiveSocket();
virtual ~UdpReceiveSocket();
&rightsign;;
// Receiving Socket Class implementation
// UdpReceiveSocket.cpp : implementation file
//
#include"stdafx.h"
#include"UdpTestApp.h"
#include"UdpReceiveSocket.h"
// UdpReceiveSocket
UdpReceiveSocket::UdpReceiveSocket()
&leftsign;
// Just specify input PORT#, local machine is assumed
BOOL bRet = Create(9122,SOCK_DGRAM,FD_READ);
if (bRet != TRUE)
&leftsign;
UINT uErr = GetLastError();
TCHAR szError[256];
wsprintf(szError, "Server Receive Socket Create() failed: %d", uErr);
AfxMessageBox(szError);
&rightsign;
&rightsign;
UdpReceiveSocket::~UdpReceiveSocket()
&leftsign;
&rightsign;
// UdpReceiveSocket member functions
voidUdpReceiveSocket::OnReceive(int nErrorCode)
&leftsign;
staticint i=0;
i++;
TCHAR buff[4096];
int nRead;
CString strSendersIp;
UINT uSendersPort;
// Could use Receive here if you don’t need the senders address&port
nRead = ReceiveFromEx(buff, 4096, strSendersIp, uSendersPort);
switch (nRead)
&leftsign;
case 0: // Connection was closed.
Close();
break;
case SOCKET_ERROR:
if (GetLastError() != WSAEWOULDBLOCK)
&leftsign;
AfxMessageBox ("Error occurred");
Close();
&rightsign;
break;
default:// Normal case: Receive() returned the # of bytes received.
buff[nRead] = 0;//terminate the string (assuming a string for this example)
CString strReceivedData(buff); // This is the input data
&rightsign;
CAsyncSocket::OnReceive(nErrorCode);
&rightsign;
// Sending Socket Class definition
#pragmaonce
// UdpSendSocket
classUdpSendSocket :public CAsyncSocket
&leftsign;
bool m_bReadyToSend;
public:
UdpSendSocket();
virtual ~UdpSendSocket();
//
virtualbool Send(constvoid* lpBuf,int nBufLen );
virtualvoid OnSend(int nErrorCode);
&rightsign;;
————————————————————
// Sending Socket Class implementation
// UdpSendSocket.cpp : implementation file
//
#include"stdafx.h"
#include"UdpTestApp.h"
#include"UdpSocket.h"
// UdpSendSocket
UdpSendSocket::UdpSendSocket():m_bReadyToSend(false)
&leftsign;
// Create a socket for sending
// **DO NOT SPECIFY DESTINATION ADDRESS HERE**
BOOL bRet = Create(0,SOCK_DGRAM,FD_WRITE);
if (bRet != TRUE)
&leftsign;
UINT uErr = GetLastError();
TCHAR szError[256];
wsprintf(szError, "Send Socket Create() failed: %d", uErr);
AfxMessageBox(szError);
&rightsign;
&rightsign;
UdpSendSocket::~UdpSendSocket()
&leftsign;
&rightsign;
// UdpSendSocket member functions
voidUdpSendSocket::OnSend(int nErrorCode)
&leftsign;
m_bReadyToSend =true;// The socket is now ready to send
CAsyncSocket::OnSend(nErrorCode);
&rightsign;
boolUdpSendSocket::Send(constvoid* lpBuf,int nBufLen)
&leftsign;
if ( ! m_bReadyToSend )
return(false);
m_bReadyToSend =false;
int dwBytes;
CAsyncSocket *paSocket =this;
// Specify destination here (IP number obscured – could use computer name instead)
if ((dwBytes = CAsyncSocket::SendToEx((LPCTSTR)lpBuf,nBufLen,9122,"172.XX.XX.XXX")) == SOCKET_ERROR)
&leftsign;
UINT uErr = GetLastError();
if (uErr != WSAEWOULDBLOCK)
&leftsign;
TCHAR szError[256];
wsprintf(szError, "Server Socket failed to send: %d", uErr);
AfxMessageBox(szError);
&rightsign;
return(false);
&rightsign;
return(true);
&rightsign;
// UdpTestAppDlg.cpp
…
voidCUdpTestAppDlg::SendUdpDatagram()
&leftsign;
CString strTestMessage = "Hello World";
m_ussSendSocket1.Send(strTestMessage.GetBuffer(),strTestMessage.GetLength()+1);
m_ussSendSocket2.Send(strTestMessage.GetBuffer(),strTestMessage.GetLength()+1);
&rightsign;
…
/ UdpTestAppDlg.h : header file
//
#pragmaonce
#include"UdpReceiveSocket.h"
#include"UdpSendSocket.h"
// CUdpTestAppDlg dialog
classCUdpTestAppDlg :public CDialog
&leftsign;
…
// Implementation
protected:
HICON m_hIcon;
UdpReceiveSocket m_ursReceiveSocket; // Receive socket
UdpSendSocket m_ussSendSocket1; // Just holds Ip&port # for send
UdpSendSocket m_ussSendSocket2; // Just holds Ip&port # for send
void SendUdpDatagram();
…
&rightsign;;//
1228 SOCKET 编程 资料
Beej网络socket编程指南 qiujianben(转贴)
http://www.csdn.net/develop/article/18/18237.shtm
Beej\’s 网络编程指南
Internet Sockets
Version 1.5.5 (13-Jan-1999)
[http://www.ecst.csuchico.edu/~beej/guide/net]
WinSock之基础API(二)
http://hi.baidu.com/hnxyy/blog/item/6e96eec467c816a98326ac7a.html
void CSimpleTcpClientDlg::DownloadFile()
&leftsign;
char buff[512];
CString s;
WSADATA wsaData;
struct hostent *hp;
unsigned int addr;
struct sockaddr_in server;
CString servername;
CString filepath;
CString filename;
ParseURL(m_url,servername,filepath,filename);
int wsaret=WSAStartup(0×101,&wsaData);
if(wsaret)
return;
s.Format("Initialized WinSock");
m_list.AddString(s);
SOCKET conn;
conn=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(conn==INVALID_SOCKET)
return;
s.Format("SOCKET created");
m_list.AddString(s);
if(inet_addr(servername)==INADDR_NONE)
&leftsign;
hp=gethostbyname(servername);
&rightsign;
else
&leftsign;
addr=inet_addr(servername);
hp=gethostbyaddr((char*)&addr,sizeof(addr),AF_INET);
&rightsign;
if(hp==NULL)
&leftsign;
closesocket(conn);
return;
&rightsign;
s.Format("hostname/ipaddress resolved");
m_list.AddString(s);
server.sin_addr.s_addr=*((unsigned long*)hp->h_addr);
server.sin_family=AF_INET;
server.sin_port=htons(80);
if(connect(conn,(struct sockaddr*)&server,sizeof(server)))
&leftsign;
closesocket(conn);
return;
&rightsign;
s.Format("Connected to server :- %s",servername);
m_list.AddString(s);
sprintf(buff,"GET %s\\r\\n\\r\\n",filepath);
send(conn,buff,strlen(buff),0);
s.Format("sending command :- GET %s to server",filepath);
m_list.AddString(s);
CFile f;
int y;
CString fname="c:\\\\";
fname+=filename;
f.Open(fname,CFile::modeCreate &line; CFile::modeWrite);
s.Format("starting to receive file");
m_list.AddString(s);
while(y=recv(conn,buff,512,0))
&leftsign;
f.Write(buff,y);
&rightsign;
f.Close();
s.Format("File downloaded and saved :- %s",fname);
m_list.AddString(s);
closesocket(conn);
s.Format("SOCKET closed");
m_list.AddString(s);
WSACleanup();
s.Format("De-Initialized WinSock");
m_list.AddString(s);
&rightsign;
server端
void main()
&leftsign;
SOCKET socket1;
InitWinsock(); //初始化,你自己写一个吧
struct sockaddr_in local;
struct sockaddr_in from;
int fromlen =sizeof(from);
local.sin_family=AF_INET;
local.sin_port=htons(1000); ///监听端口
local.sin_addr.s_addr=INADDR_ANY; ///本机
socket1=socket(AF_INET,SOCK_DGRAM,0);
bind(socket1,(struct sockaddr*)&local,sizeof local);
while (1)
&leftsign;
char buffer[1024]="\\0";
printf("waiting for message from others————-\\n");
if (recvfrom(socket1,buffer,sizeof buffer,0,(struct sockaddr*)&from,&fromlen)!=SOCKET_ERROR)
&leftsign;
printf("Received datagram from %s–%s\\n",inet_ntoa(from.sin_addr),buffer);
////给cilent发信息
sendto(socket1,buffer,sizeof buffer,0,(struct sockaddr*)&from,fromlen);
&rightsign;
Sleep(500);
&rightsign;
closesocket(socket1);
&rightsign;
Client端
void main()
&leftsign;
SOCKET socket1;
InitWinsock();
struct sockaddr_in server;
int len =sizeof(server);
server.sin_family=AF_INET;
server.sin_port=htons(1000); ///server的监听端口
server.sin_addr.s_addr=inet_addr("192.168.1.101"); ///server的地址
socket1=socket(AF_INET,SOCK_DGRAM,0);
while (1)
&leftsign;
char buffer[1024]="\\0";
printf("input message\\n");
scanf("%s",buffer);
if (strcmp(buffer,"bye")==0)
break;
if (sendto(socket1,buffer,sizeof buffer,0,(struct sockaddr*)&server,len)!=SOCKET_ERROR)
&leftsign;
if (recvfrom(socket1,buffer,sizeof buffer,0,(struct sockaddr*)&server,&len)!=SOCKET_ERROR)
printf("rece from server:%s\\n",buffer);
&rightsign;
&rightsign;
closesocket(socket1);
&rightsign;