快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

asp.net中的vb7中如何使用socket作一个传送时间的server

/*
豆腐制作,都是精品
http://www.asp888.net 豆腐技术站
如转载 请注明出处
*/

利用Socket 可以编写一个 向 客户端传送 时间的 一个程序,现在他还只能向
固定的客户端 传送时间,我打算过几天 写一个 可以向 浏览器传送 时间的一个程序
请大家随时注重我的站点的更新情况。。。
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Text

Public Class DateTimeServer
Public Shared Sub temp()
System.Console.WriteLine(\"hello\")
Console.Writeline(\"Hello/n\")
End Sub

Public Shared Sub Main()
Dim now As Date
Dim strDateLine As String
Dim ASCII As Encoding = Encoding.ASCII

Dim tcpl As New TCPListener(13) \\\'listen on port 13

tcpl.Start()

Console.WriteLine(\"Waiting for clients to connect\")
Console.WriteLine(\"Press Ctrl+c to Quit...\")

While (True)
\\\' Accept will block until someone connects
Dim s As Socket = tcpl.Accept()

\\\' Get the current date and time then concatenate it
\\\' into a string
now = DateTime.Now
strDateLine = now.ToShortDateString() + \" \" + now.ToLongTimeString()

\\\' Convert the string to a Byte Array and send it
Dim byteDateLine() As Byte = ASCII.GetBytes(strDateLine.ToCharArray())
s.Send(byteDateLine, byteDateLine.Length, 0)
Console.WriteLine(\"Sent \" + strDateLine)
End While
End Sub
End Class


返回类别: 教程
上一教程: The following FAQ answers some of the most common questions about .NET Reflector.
下一教程: 用WinDbg探索CLR世界 [3] 跟踪方式的 JIT 过程

您可以阅读与"asp.net中的vb7中如何使用socket作一个传送时间的server"相关的教程:
· asp.net中的vb7中如何调用dll中的函数
· 如何使用.net操作ddeml?
· ASP.NET中如何防范SQL注入式攻击
· ASP.NET中如何调用存储过程
· 在ASP+ 中我们如何使用 Class 而不是组件
    微笑服务 优质保证 索取样品