CreateSocket Issues

On very old Synapse versions you must always call CreateSocket explicitly.

Then I do 'autocreate' socket capability. When You call Connect or Bind on non- created socket, then Synapse call CreateSocket. With this case you not need call CreateSocket explicitly. You need call this only on special cases.

From release 31 is CreateSocket changed!

By default, you not need call CreateSocket. It is created automatically. When you have family on SF_Any (default), then Synapse must know IP address for determinig, if must create IPv4 or IPv6 socket. This is reason, why I moved creating of socket after name resolution in Connect or Bind method.

If you call Connect or Bind on non-created socket, then Synapse try to resolve given address, and create socket by family of given address.

When you call explicitly CreateSocket, then you break this autodetection. Never mind! When you set Family on SF_Any (default), then CreateSocket do nothing! When you set some socket properties, then it is remembered and aplied after real socket is created. It allows maximum possible compatibility with older code.

When you set family to IPv4 or Ipv6, then CreateSocket working on standard way.

Exists new function CreateSocketByName. It have one argument for name. This function resolve given name first, and then create socket with family by given name.

When you have special case and need create socket before Connect or Bind, then you must set another family then SF_Any, or you must call CreateSocketByName.

When you need only set special properties after socket creation and before using of Socks in Connect or Bind call, then you can use hook OnCreateSocket.

public/howto/createsocket.txt · Last modified: 2011/07/12 18:01 by daemon_x
Driven by DokuWiki Recent changes RSS feed