c语言socket界面编程的有关问题,大神求解答
c语言socket界面编程的问题,大神求解答
使用socket网络编有界面的程序时,应该在怎么定义一个socket,是在窗口函数还是winmain中定义。还有在哪里定义sockaddr_in这个数据结构,以及其参数,是在窗口过程中么???求哪位大神给一段简单的界面socket代码
------解决方案--------------------
http://wenku.baidu.com/view/06fb16bec77da26925c5b03b.html
第7,8页,有直接的代码,使用的wsaselect模型。 你可以抄过去自己研究研究
------解决方案--------------------
看看这里的socket例子代码吧:
http://download.****.net/detail/geoff08zhang/4571358
------解决方案--------------------
这个帖子不就是了
http://bbs.****.net/topics/390257815
------解决方案--------------------

要大胆尝试,多看看msdn吧
This function creates a socket that is bound to a specific service provider.
Note This function is actually a Winsock function. However, the information that is presented in it is specific to Bluetooth.
SOCKET socket(
int af,
int type,
int protocol
);
Parameters
af
[in] Address family specification. To create a Bluetooth socket, use: af = AF_BTH
type
[in] Type specification for the new socket. To create a Bluetooth socket, use:
type = SOCK_STREAM
protocol
[in] Protocol to be used with the socket that is specific to the indicated address family. To create a Bluetooth socket, use:
protocol = BTHPROTO_RFCOMM
Return Values
If no error occurs, this function returns a descriptor referencing the new socket. If an error occurs, a value of INVALID_SOCKET is returned, and a specific error code can be retrieved by calling WSAGetLastError.
Remarks
The following example code shows how to use socket to create a Bluetooth socket.
SOCKET s = socket (AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
For more information about the socket function, see socket (Windows Sockets) in the Winsock reference.
使用socket网络编有界面的程序时,应该在怎么定义一个socket,是在窗口函数还是winmain中定义。还有在哪里定义sockaddr_in这个数据结构,以及其参数,是在窗口过程中么???求哪位大神给一段简单的界面socket代码
------解决方案--------------------
http://wenku.baidu.com/view/06fb16bec77da26925c5b03b.html
第7,8页,有直接的代码,使用的wsaselect模型。 你可以抄过去自己研究研究
------解决方案--------------------
看看这里的socket例子代码吧:
http://download.****.net/detail/geoff08zhang/4571358
------解决方案--------------------
这个帖子不就是了
http://bbs.****.net/topics/390257815
------解决方案--------------------
要大胆尝试,多看看msdn吧
This function creates a socket that is bound to a specific service provider.
Note This function is actually a Winsock function. However, the information that is presented in it is specific to Bluetooth.
SOCKET socket(
int af,
int type,
int protocol
);
Parameters
af
[in] Address family specification. To create a Bluetooth socket, use: af = AF_BTH
type
[in] Type specification for the new socket. To create a Bluetooth socket, use:
type = SOCK_STREAM
protocol
[in] Protocol to be used with the socket that is specific to the indicated address family. To create a Bluetooth socket, use:
protocol = BTHPROTO_RFCOMM
Return Values
If no error occurs, this function returns a descriptor referencing the new socket. If an error occurs, a value of INVALID_SOCKET is returned, and a specific error code can be retrieved by calling WSAGetLastError.
Remarks
The following example code shows how to use socket to create a Bluetooth socket.
SOCKET s = socket (AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
For more information about the socket function, see socket (Windows Sockets) in the Winsock reference.