windows-socket-api

Binding an ipv6 slaac address to windows IP Stack error 10049

断了今生、忘了曾经 提交于 2020-01-23 11:39:16
问题 Background: This is the 2nd time a call to bind has stopped my project's dev progress. The first time was Selecting a socket interface for any unknown environment. bind was the perceived fault then, its opaque source code not allowing me to see the spurious Hyper-V interface. I implemented Remy Lebeau's suggestion of using GetAdaptersAddresses to cycle through the adapter interfaces to get the desired entry. Since I am creating an ipv6 slaac ip address, I next implemented RFC7217. This

Is it possible to tell if WSAStartup has been called in a process?

╄→尐↘猪︶ㄣ 提交于 2019-12-18 11:08:43
问题 I've started writing an ActiveX control that makes use of sockets. Applications that use this control may or may not also use sockets. Is it possible for my control to tell whether WSAStartup has been called? If not, call it. A little test reveals that calling WSAStartup multiple times is tollerated. But what happens if a different winsock version is requested? will this break other parts of the application? 回答1: Yes it is possible. And here is how it's done. bool WinsockInitialized() {

bind() works for ipv6 wireless adapter interface but not for ipv6 ethernet (error 10049)

拈花ヽ惹草 提交于 2019-12-13 03:05:21
问题 Background At the beginning of my program I build a linked list of adapter interface addresses using GetAdaptersAddresses. Later, after creating an ipv6 slaac address, calling Socket() , Bind() and Listen() all succeed where the IfType is Wireless, that is, IfType 71 ( IF_TYPE_IEEE80211 ). My filter parameters are family and ifType . I test by connecting and disconnecting the ethernet cable. For each case my software finds the active interface with said parameters: connected it finds ethernet

Unable to GetUnicastIpAddressEntry after CreateUnicastIpAddressEntry

喜夏-厌秋 提交于 2019-12-13 02:59:20
问题 Background: I am trying to get up to speed on using RFC7217 compliant ipv6 addresses. To that end I have written code that creates a valid route-able ipv6 address like 2600:8806:2700:115:c4a3:36d8:77e2:cd1e . I know I need to enter the new address into windows before being able to bind() to it. I figured that these two methods would do the trick. So, using one of my ip addresses, I executed the sample code found in CreateUnicastIpAddressEntry. Then, using the same ip address, I executed the

10057 WSA Exception when SendBuf via Socket

霸气de小男生 提交于 2019-12-11 07:05:43
问题 Client: //is called when the client tries to log in procedure TLogin_Form.btnLoginClick(Sender: TObject); var LoginQuery: TQuery; begin //If socket not open, open it if not LoginSocket.Active then begin LoginSocket.Open; end; //create package LoginQuery.Login := ledtName.Text; LoginQuery.Passwort := ledtPasswort.Text; LoginQuery.IP := LoginSocket.Socket.LocalAddress; //send package LoginSocket.Socket.SendBuf(LoginQuery, SizeOf(LoginQuery)); end; Server: //This procedure is executed when I

WSA error 10048 when binding server sockets

痞子三分冷 提交于 2019-12-02 03:06:40
问题 I started with the simple server tutorial on the msdn website in order to learn how to use sockets in client and server applications. Once I was done following thet tutorial, I started adapting the client and server code into multithreaded proggrams in order to make a tchat client and server. Everything was going very well until I ran into WSA error 10048. I tried using different ports for each socket but it still did not solve the error. Here is my server code : #undef UNICODE #define WIN32

Is it possible to tell if WSAStartup has been called in a process?

谁说胖子不能爱 提交于 2019-11-30 01:58:41
I've started writing an ActiveX control that makes use of sockets. Applications that use this control may or may not also use sockets. Is it possible for my control to tell whether WSAStartup has been called? If not, call it. A little test reveals that calling WSAStartup multiple times is tollerated. But what happens if a different winsock version is requested? will this break other parts of the application? Yes it is possible. And here is how it's done. bool WinsockInitialized() { SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (s == INVALID_SOCKET && WSAGetLastError() ==