![]() |
| | #1 |
| Super Moderator Join Date: Aug 2001
Posts: 7,812
| Protecting ports via winsock
__________________ If you aim at everything you will hit something but you won't know what it is. |
| Bubba is offline | |
| | #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 | |
| | #3 |
| &TH of undefined behavior 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 | |
| | #4 |
| Registered User 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 | |
| | #5 |
| Carnivore ('-'v) 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 | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |