Traditional Culture Encyclopedia - Weather forecast - I have no idea about writing a protocol based on udp protocol with c#, please ask God for advice.

I have no idea about writing a protocol based on udp protocol with c#, please ask God for advice.

What you describe here also has no clue.

The meaning of interface is very broad. When someone calls your interface, how to call it and how to implement it need to be agreed (you and the interface caller agree).

For example, in. NET platform:

This is the service interface. When the interface is written, it will be published on IIS. Other programs (JAVA) or terminals (mobile phones) can call your web interface as long as the HTTP protocol is allowed (you can look at Baidu's API, which is a good example, such as the weather forecast interface, which can be called in various programming languages).

Interface used internally by C#:

For example, in the most common factory method mode, IDAL and IBLL layers are interface layers, and interfaces are the basic things that specify function names, return values and parameters. After the interface is declared, others need to implement it.

Public? Interface? Iudp? //This is the interface.

{

String? get();

}

Public? Class? Udp:Iudp// inheritance interface

{

Public? String? Get()? //Implement the method in the interface.

{

Return? " 1234566";

}

} I suggest you find out what your interface is first. ? Then implement the interface.

It is very simple to send and receive data through UDP, which should be the simplest network programming.

Reference:/dqs78833488/article/details/51331341

Complete listening port, receiving port and closing port, no more than 300 lines of code.