블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2731)
Unity3D (814)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (57)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (51)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
03-29 00:00

'서버시간'에 해당되는 글 1건

  1. 2014.07.14 NTP 서버에서 시간 가져오기(SNTP)

[추가]

Google NTP 주소 : time.google.com

[링크] https://developers.google.com/time/



C# - Simple Network Time (NTP) Protocol Client

SNTPClient.cs






Network Time Protocol (NTP) is a protocol for synchronizing the clocks of computer systems over packet-switched, variable-latency data networks. NTP uses UDP on port 123 as its transport layer. It is designed particularly to resist the effects of variable latency by using a jitter buffer. NTP also refers to a reference software implementation that is distributed by the NTP Public Services Project.

NTP is one of the oldest Internet protocols still in use (since before 1985). NTP was originally designed by Dave Mills of the University of Delaware, who still maintains it, along with a team of volunteers.

NTP is not related to the simpler DAYTIME (RFC 867) and TIME (RFC 868) protocols.

 

위키에서 가져옴-_-

 

경로 : http://en.wikipedia.org/wiki/Network_Time_Protocol

 

 

서버 따위에서 시간을 맞추기 위해서 사용하는 프로토콜이고 이런 시간 정보를 제공하는 서버를 타임 서버라고 많이들 이야길 하죠..

 

아래  ITS 는 아주 간단하게 구현되고 사용할 수 있지만 NTP 는 좀 까다롭습니다. -_-

 

그래서 괜히 어설프게 문서 만들고 예제 만들다간 욕 처먹을거 같아서 -.- 클래스 퍼온거 올려봅니다.

 

(원래는 간단하게 -_- 만들고 있었는데 제대로 된 소스를 발견해서 쪽팔려서 지움..;; -_- )

 

 

일단 아래는 활용 예제와 결과물입니다. 

 

namespace InternetTime

{

    using System;

 

    public class Synchronizer

    {

        public Synchronizer()

        {

        }

 

        public static int Main(string[] args)

        {

            SNTPClient client;

            try

            {

                client = new SNTPClient("time.google.com"); // Google NTP 서버 주소 추가

                //client = new SNTPClient("time.nuri.net");    // 참조할 NTP 서버 주소

                client.Connect(false);

            }

            catch (Exception e)

            {

                Console.WriteLine("ERROR: {0}", e.Message);

                return -1;

            }

 

            Console.Write(client.ToString());

            return 0;

        }

    }

}



출처 : http://www.devpia.com/Maeul/Contents/Detail.aspx?BoardID=18&MAEULNO=8&no=1770&page=11




반응형

'Programming > C#' 카테고리의 다른 글

Get Dictionary key by using the dictionary value  (0) 2014.08.12
[C#] How to get/set using index for a Dictionary?  (0) 2014.08.06
C# 외부 프로그램 종료하기  (0) 2014.05.20
C# Keywords  (0) 2014.05.13
Standard Numeric Format Strings  (0) 2014.05.13
Posted by blueasa
, |