C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 03-27-2004, 05:28 AM   #1
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,812
Protecting ports via winsock

Is there a way to protect your ports via winsock?? Sort of like ZoneAlarm does - I'm fairly new to winsock so I don't know much about it.
__________________
If you aim at everything you will hit something but you won't know what it is.
Bubba is offline   Reply With Quote
Old 03-29-2004, 02:39 AM   #2
sockets mad
 
Join Date: Mar 2002
Posts: 126
I think personal firewall software attatches itself to the tcp/ip stack in some way to inspect it. Similar to some virus software with real-time scanners.

Don't ask me how it's done progmatically though, because I don't have a clue.
codec is offline   Reply With Quote
Old 03-29-2004, 08:04 AM   #3
&TH of undefined behavior
 
Fordy's Avatar
 
Join Date: Aug 2001
Posts: 5,216
Lookup Layered Service Providers at MSDN
__________________
"If A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut."
Albert Einstein (1879 - 1955)


Board Rules
Fordy is offline   Reply With Quote
Old 03-31-2004, 12:15 AM   #4
Registered User
 
BlackBird's Avatar
 
Join Date: Mar 2004
Posts: 4
HI am new to the board and winsock too

i had the same idea for a program; only problem i dont know that much about winsock so i made this last monday it listen on a port when some one connect it print the person ip;
i think i will work to make it work how i want it to plus i got a win c++ networking ebook;
and if u put it on a listening port it will not work :-()

have to include winsock stuff

#include "stdafx.h"
WSADATA WD;
struct sockaddr_in tcpaddr,enemy;
#include <stdlib.h>



int main()
{

WSAStartup(MAKEWORD(1,1),&WD);
cout<<" Pleast enter the port you want this I am sillyI am sillyI am sillyI am silly to listen on"<<endl;
int port;
cin>>port;
SOCKET G;
G=socket (AF_INET,SOCK_STREAM,IPPROTO_TCP);

tcpaddr.sin_family = AF_INET;
tcpaddr.sin_port = htons(port);
tcpaddr.sin_addr.s_addr = htonl(INADDR_ANY);

bind(G, (SOCKADDR *)&tcpaddr, sizeof(tcpaddr));


listen(G,SOMAXCONN);
while (1)
{

int A =sizeof(enemy);
accept (G,(SOCKADDR *)&enemy,&A);
cout<<"the ip"<<inet_ntoa(enemy.sin_addr)<<"the port"<<ntohs(enemy.sin_port)<<endl;

}


return 0;
}
BlackBird is offline   Reply With Quote
Old 04-01-2004, 09:17 PM   #5
Carnivore ('-'v)
 
Hunter2's Avatar
 
Join Date: May 2002
Posts: 2,866
BlackBird, I don't think that's what he's looking for.

The 'hacker' trying to connect wouldn't be able to connect anyways unless there's a trojan or something listening on that port. If there is, then your call to bind() and listen() will fail anyways, because *surprise* that port has already been taken. Then you will be utterly helpless to do anything while the hacker proceeds to destroy your computer and burn down your house, after murdering your wife and children by programmatically unplugging them from the Matrix.
__________________
Just Google It. √

(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.
Hunter2 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Winsock issues tjpanda Windows Programming 3 12-04-2008 08:32 AM
virtual ports royuco77 Networking/Device Communication 5 07-02-2005 10:33 AM
Where do I initialize Winsock and catch messages for it? Lithorien Windows Programming 10 12-30-2004 12:11 PM
Winsock and Ports jimboob Networking/Device Communication 4 06-27-2004 03:24 AM
Winsock Ports gnu-ehacks Windows Programming 2 03-18-2002 09:33 AM


All times are GMT -6. The time now is 02:27 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22