{"id":34283,"date":"2005-09-08T10:00:19","date_gmt":"2005-09-08T10:00:19","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2005\/09\/08\/why-does-the-function-wsasetlasterror-exist\/"},"modified":"2005-09-08T10:00:19","modified_gmt":"2005-09-08T10:00:19","slug":"why-does-the-function-wsasetlasterror-exist","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20050908-19\/?p=34283","title":{"rendered":"Why does the function WSASetLastError exist?"},"content":{"rendered":"<p>Why does the function <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winsock\/winsock\/wsasetlasterror_2.asp\"> <code>WSASetLastError<\/code><\/a> exist when there is already the perfectly good function <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/debug\/base\/setlasterror.asp\"> <code>SetLastError<\/code><\/a>?<\/p>\n<p> Actually, you know the answer too, if you sit down and think about it. <\/p>\n<p> Winsock was originally developed to run on both 16-bit Windows and 32-bit Windows. Notice how the classic Winsock functions are based on window messages for asynchronous notifications. In the 16-bit world, there was no <code>SetLastError<\/code> function. Therefore, Winsock had to provide its own version for the 16-bit implementation. And since source code compatibility is important, there was a 32-bit version as well. Of course, the 32-bit version looks kind of stupid in retrospect if you aren&#8217;t aware of the 16-bit version. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Why does the function WSASetLastError exist when there is already the perfectly good function SetLastError? Actually, you know the answer too, if you sit down and think about it. Winsock was originally developed to run on both 16-bit Windows and 32-bit Windows. Notice how the classic Winsock functions are based on window messages for asynchronous [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-34283","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>Why does the function WSASetLastError exist when there is already the perfectly good function SetLastError? Actually, you know the answer too, if you sit down and think about it. Winsock was originally developed to run on both 16-bit Windows and 32-bit Windows. Notice how the classic Winsock functions are based on window messages for asynchronous [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/34283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=34283"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/34283\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=34283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=34283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=34283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}