PDA

Click to See Complete Forum and Search --> : Help setting socket protocol


gmcc
Mar 23rd, 2006, 03:21 PM
I have a small server daemon running on linux, the socket for the server is a SOCK_DGRAM, the protocol is ETH_DISCO_P (defined by me). I want to be able to send messages to this server from visual basic.
I cannot seem to set the protocol of the socket.

I have defined "Private Const ETH_P_DISCO As ProtocolType = &H88AD" same as in my server daemon.

When I try to open a socket like
"_socket = New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ETH_P_DISCO)"
i get a socket exception; Message "The requested protocol has not been configured into the system, or no implementation for it exists"

How can i configure this protocol, or maybe some one know a better way to do this. The server and client are both working from linux. Can this even be done from VB?

the182guy
Mar 23rd, 2006, 06:27 PM
use Winsock for VB6 sockets on a TCP or UDP connection, is your linux socket TCP based? you can use PHP sockets on a linux server on TCP protocol, which you can communicate with VB

gmcc
Mar 23rd, 2006, 07:29 PM
my linux socket is create by a call to socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_DISCO), so it is a datagram socket, kind of like UDP (if it were udp, the third arg in socket call would be 0 or IPPROTO_UDP). The server's socket protocol is ETH_P_DISCO. Can I create a socket with VB whose protocol type is user defined. How would I go about doing that?

forgive my ignorance, what is a PHP socket. do you mean use PHP as the programming language? The server is already written in C.

Hack
Mar 24th, 2006, 07:02 AM
forgive my ignorance, what is a PHP socket.PHP Sockets (http://www.tutorialized.com/tutorial/Introduction-to-PHP-Sockets/1161)

the182guy
Mar 24th, 2006, 08:33 AM
PHP sockets are not great if you want to maintain a connection for a long period though, as they have to be started by a web browser, and the broswer has to stay open untils your done witht he connection. But for short connections they are great

gmcc
Mar 24th, 2006, 09:29 AM
PHP sockets are just TCP/UDP socket written in PHP, I am using visual basic for the client and C for the server. The server is listening on his network interface for datagram packets of type ETH_P_DISCO which in this case is a replacement for UDP, there is no ip address in my protocol just ethernet addresses.

I would like to be able to send this kind of packet using a visual basic System.Net.Sockets.Socket