Re: Exclusive access to IP-address
- From: "Volodymyr M. Shcherbyna" <v_scherbina@xxxxxxxxxxxxxxx>
- Date: Wed, 20 Feb 2008 16:28:17 +0100
You mix several topics here.
I want to send data to a network printer, bypassing any Windows drivers. To
do this, I use this code to get a socket to that printer:
Your code actually goes via TDI and NDIS layers.
What I need is to block any other workstations or processes to open a
connection to that same IP-address. Can this be done?
No, this is cannot be done. Unless you install something on client's
machines to block access to IP.
The current program is written in Visual Studio 2005, C++, but if you know
another way or language to achieve this: any help is welcome.
Language does not matter. If you want to disallow connections to some
server, you can do this by modifying the code of server, so that it accepts
only special clients. If this is a network printer, and you are unable to
modify it's code, you have to redesign your solution.
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Marc" <Marc@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9055537C-55C7-4486-A79F-F5C9028CC590@xxxxxxxxxxxxxxxx
I want to send data to a network printer, bypassing any Windows drivers. To
do this, I use this code to get a socket to that printer:
SOCKET ConnectSocket;
int InitIpConnection (char* strIPAddress, unsigned short sPort)
{
WSADATA wsaData;
int iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != NO_ERROR)
{
return 1;
}
//----------------------
// Create a SOCKET for connecting to server
ConnectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (ConnectSocket == INVALID_SOCKET)
{
WSACleanup();
return 2;
}
//----------------------
sockaddr_in clientService;
clientService.sin_family = AF_INET;
clientService.sin_addr.s_addr = inet_addr( strIPAddress );
clientService.sin_port = htons( sPort );
//----------------------
// Connect to server.
if ( connect( ConnectSocket, (SOCKADDR*) &clientService,
sizeof(clientService) ) == SOCKET_ERROR)
{
WSACleanup();
return 3;
}
return 0;
};
What I need is to block any other workstations or processes to open a
connection to that same IP-address. Can this be done?
The current program is written in Visual Studio 2005, C++, but if you know
another way or language to achieve this: any help is welcome.
Marc
.
- Follow-Ups:
- Re: Exclusive access to IP-address
- From: Marc
- Re: Exclusive access to IP-address
- Prev by Date: Re: get reservations from DHCP server
- Next by Date: Re: Set IP address from managed code
- Previous by thread: Re: Multicast group membership
- Next by thread: Re: Exclusive access to IP-address
- Index(es):
Relevant Pages
|
|