(104)
(1)
(13)
(31)
(59)
分类: web开发
2013-11-24 16:59:57
- public class client
- {
- private static byte[] result = new byte[1024];
- public string serverip = "127.0.0.1";
- public int severport = 8880;
- public client(string serverip, int serverport)
- {
- this.serverip = serverip;
- this.severport = serverport;
- }
- public void start()
- {
- //设定服务器ip地址
- ipaddress ip = ipaddress.parse(serverip);
- socket clientsocket = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp);
- try {
- clientsocket.connect(new ipendpoint(ip, severport));
- console.writeline("连接服务器成功");
- } catch {
- console.writeline("连接服务器失败");
- return;
- }
- int receivelength;
- while (clientsocket.connected) {
- receivelength = clientsocket.receive(result);
- string sv_word = encoding.ascii.getstring(result, 0, receivelength);
- console.writeline("sever> {0}", sv_word);
- if (sv_word.trim() == "bye") break;
- console.write("> ");
- string words = console.readline();
- if (string.isnullorempty(words)) words = "\n";
- clientsocket.send(encoding.ascii.getbytes(words));
- if (words.trim() == "bye") break;
- }
- if(clientsocket.connected) clientsocket.close();
- console.writeline("> bye bye");
- }
- }
上一篇:
下一篇:
wwwkljoel2013-11-30 09:14:31
:
首先不知道你的留言是机器自动留言还是一番感悟之后的肺腑之谈。
原创是在很多积累之后的厚积薄发,能够解人之惑,或指引方向,提供方案,娱人心情等等让人有所收获。这样的文章能够帮助人,本身就有吸引力,其他地方又不存在,当然能够博得很好的眼球关注度。
但是,能把这些东西采集汇总,同样是吸引人的,让人能够更好更系统的获取自己关注的东西。而搜索引擎算法,那是不得不采取的方法,不然怎么粗采众文。人的想法是多样的,搜索算法增么能够尽人皆美。
原创和采集同样重要,正当的排名也是一种去粗求精的手段,何非议之有?