<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      asp.net中的vb7中怎么使用socket作一個傳送時間的server

      [摘要]/*豆腐制作,都是精品http://www.asp888.net 豆腐技術站如轉載 請注明出處*/ 利用Socket 可以編寫一個 向 客戶端傳送 時間的 一個程序,現在他還只能向固定的客戶端 傳送...
      /*
      豆腐制作,都是精品
      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





      日韩精品一区二区三区高清