Я нашел решение: чтобы анимация не перекрывала текущее значение свойства, удалите его или присвойте ему FillBehavior из Stop .
A web server starts out as being an extremely simple piece of code:
So the outline of the code is easy.
Now, you have some complexities to handle:
Handling the possibility of multiple connections is also relatively easy, with a number of possible choices.
Running a program is actually fairly easy too. In general, you define a special path to a CGI directory; a URL that has a path through that directory then interprets the path name as the path to a program. The server would then create a subprocess using fork/exec, with STDOUT connected to the socket. The program then runs, sending output to STDOUT, and it is sent on to the client browser.
This is the basic pattern; everything else a web server does is just adding frills and additional functionality to this basic pattern.
Here are some other sources for example code:
It pretty much does nothing of what you really wanted, but for simple it's hard to beat this one from http://www.commandlinefu.com:
$ python -m SimpleHTTPServer
Firstly, please don't let this become a usable project - getting security right for web servers is really hard.
Ok, here are things to keep in mind:
Good luck - this is a hell of a job.
The networking et al are pretty standard fair, so don't worry so much about that. (there are several "instant", sample network servers in most any language.)
Instead, focus on actually implementing the HTTP specification. You'll be amazed at a) what you don't know and b) how much things that are supposed to be HTTP compliant, really aren't, but fake it well.
Then you'll marvel that the web works at all.
When you're done with HTTP, enjoy trying to implement IMAP.
I wrote a light webserver in Python a few years back, also as a learning project.
The simplest piece of advice I can give, especially as a learning project, is build a core that works, then iterative design on top of that. Don't aim for the moon right off the hop, start very small, then add featuers, refine and continue. I would recommend using a tool that encourages expermentation, like Python, where you can literally type and test code at the same time.
Я подумывал начать тот же проект, чтобы лучше изучить Python. Класс BaseHTTPServer - неплохая отправная точка.
В курсе, который я проводил, было задание по доверенности, так что я могу пролить свет здесь, я думаю.
Итак, вы собираетесь в конечном итоге делать много изменений заголовков, просто чтобы облегчить тебе жизнь. А именно, с HTTP / 1.0 гораздо проще работать, чем с HTTP / 1.1. Вы не хотите иметь дело с управлением тайм-аутами, сообщениями поддержки активности и тому подобным. Проще всего одно соединение на транзакцию.
Вы будете выполнять много-много синтаксического анализа. Анализировать сложно в C. Я бы посоветовал вам написать функцию, похожую на
int readline(char *buff, int maxLen) {
while((c = readNextCharFromSocket(&s)) && c != '\n' && i < maxLen)
buff[i++] = c;
return i;
}
, и обрабатывать ее по одной строке за раз, исключительно потому, что проще всего использовать существующие строковые функции C по одной строке за раз. Также помните, что строки разделены \ r \ n, а заголовки заканчиваются \ r \ n \ r \ n.
Самым сложным будет синтаксический анализ,