التنبيهات التالية ظهرت :
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 864 - File: showthread.php PHP 7.4.33 (Linux)
File Line Function
/showthread.php 864 errorHandler->error



تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] اريد شرح الكود او توضيح الفكرة العامة له
#1
السلام عليكم ورحمة الله وبركاته
اريد حد يشرحلى الكود ده او يوضح الفكرة العامة له


كود :
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox(GetFastestNISTDate().ToLocalTime)
    End Sub

    Public Function GetFastestNISTDate() As DateTime
        Dim result = DateTime.MinValue
        ' Initialize the list of NIST time servers
        ' http://tf.nist.gov/tf-cgi/servers.cgi
        Dim servers As String() = New String() _
        {"nist1-ny.ustiming.org", "nist1-nj.ustiming.org", "nist1-pa.ustiming.org", "time-a.nist.gov", "time-b.nist.gov", "nist1.aol-va.symmetricom.com", _
         "nist1.columbiacountyga.gov", "nist1-chi.ustiming.org", "nist.expertsmi.com", "nist.netservicesgroup.com"}

        ' Try 5 servers in random order to spread the load
        Dim rnd As New Random()
        For Each server As String In servers.OrderBy(Function(s) rnd.NextDouble()).Take(5)
            Try
                ' Connect to the server (at port 13) and get the response
                Dim serverResponse As String = String.Empty
                Using reader = New IO.StreamReader(New System.Net.Sockets.TcpClient(server, 13).GetStream())
                    serverResponse = reader.ReadToEnd()
                End Using

                ' If a response was received
                If Not String.IsNullOrEmpty(serverResponse) Then
                    ' Split the response string ("55596 11-02-14 13:54:11 00 0 0 478.1 UTC(NIST) *")
                    Dim tokens As String() = serverResponse.Split(" "c)

                    ' Check the number of tokens
                    If tokens.Length >= 6 Then
                        ' Check the health status
                        Dim health As String = tokens(5)
                        If health = "0" Then
                            ' Get date and time parts from the server response
                            Dim dateParts As String() = tokens(1).Split("-"c)
                            Dim timeParts As String() = tokens(2).Split(":"c)

                            ' Create a DateTime instance
                            Dim utcDateTime As New DateTime(Convert.ToInt32(dateParts(0)) + 2000, Convert.ToInt32(dateParts(1)), Convert.ToInt32(dateParts(2)), Convert.ToInt32(timeParts(0)), Convert.ToInt32(timeParts(1)), Convert.ToInt32(timeParts(2)))

                            ' Convert received (UTC) DateTime value to the local timezone
                            result = utcDateTime '.ToLocalTime()

                            ' Response successfully received; exit the loop

                            Return result
                        End If

                    End If

                End If
                ' Ignore exception and try the next server
            Catch
            End Try
        Next
        Return result
    End Function

End Class
الرد }}}
تم الشكر بواسطة: hoob computer


الردود في هذا الموضوع
اريد شرح الكود او توضيح الفكرة العامة له - بواسطة ali.alfoly - 17-10-13, 05:48 PM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  اريد اضافة حفظ PDF فى مسار على الهارد- مثال الاستاذ عبدالله الدوسري new_programer 0 49 13-04-24, 12:59 PM
آخر رد: new_programer
  ممكن حل المشكلة فى الكود التالي - من مشاركة استاذنا القدير / عبدالله الدوسري new_programer 4 177 02-03-24, 07:36 PM
آخر رد: new_programer
  ماهو حل هذا الخطأ في الكود melad2002 7 275 25-02-24, 12:25 AM
آخر رد: justforit
  كيفية انشاء سكريبت لقاعدة بيانات من خلال الكود heem1986 1 214 20-02-24, 12:00 AM
آخر رد: Kamil
  [VB.NET] أرغب فى استخدام هذا الكود بالتحديد على الإصدار 10 AmeenRashed 3 211 19-01-24, 12:42 PM
آخر رد: Taha Okla
  اريد طباعة الباركود المحدد فقط مع الكمية new_programer 5 450 09-01-24, 08:40 PM
آخر رد: new_programer
  اريد مساعدة في العملية الحسابية melad2002 3 426 29-12-23, 09:10 PM
آخر رد: melad2002
  [VB.NET] ما الخطأ فى هذا الكود - كود البحث المتعدد Ashraf Elafify 7 476 27-12-23, 10:50 PM
آخر رد: Ashraf Elafify
  [كود] اريد كود إرسال البيانات من الفيجوال بيسك إلىPDF issamsaidd 10 5,866 25-12-23, 06:30 PM
آخر رد: الحزين اليماني
  [VB.NET] اريد تعديل في الكود عند طباعة DGV abu_hisham7 1 443 03-12-23, 02:40 AM
آخر رد: abu_hisham7

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم