Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to get the Internet IP Pin
TalkingBabb0t21-Jul-04 17:19
TalkingBabb0t21-Jul-04 17:19 
GeneralUser interface samples Pin
machocr21-Jul-04 2:51
machocr21-Jul-04 2:51 
GeneralRe: User interface samples Pin
Nick Parker21-Jul-04 3:04
protectorNick Parker21-Jul-04 3:04 
Generalnotify in taskmanager Pin
Ravikumar_mv21-Jul-04 1:53
Ravikumar_mv21-Jul-04 1:53 
GeneralRe: notify in taskmanager Pin
Ravikumar_mv21-Jul-04 1:59
Ravikumar_mv21-Jul-04 1:59 
GeneralRe: notify in taskmanager Pin
Heath Stewart21-Jul-04 6:40
protectorHeath Stewart21-Jul-04 6:40 
GeneralRe: notify in taskmanager Pin
Ravikumar_mv21-Jul-04 18:48
Ravikumar_mv21-Jul-04 18:48 
GeneralClosing Tcp connections // (for Axel Charpentier) Pin
Ahmad Mehrbod21-Jul-04 1:50
Ahmad Mehrbod21-Jul-04 1:50 
Hello.

I read the article "Getting active TCP/UDP connections on a box" in coldeproject.com.
My application get all tcp connections and should close user selected connections.
But I have 2 problems:

problem 1 : I want to close slelected port from Listening ports.
I wrote below code for it ,but this don't work properly:

[DllImport("iphlpapi.dll",SetLastError=true)]
public extern static int SetTcpEntry(IntPtr pTcpRow);

IPHlpAPI32Wrapper.MIB_TCPROW Kill=new IPHlpAPI32Wrapper.MIB_TCPROW();
IntPtr current= globaltablepointer;
//globaltablepointer poit to start of array of MIB_TCPROW structure
current=(IntPtr)((int) current+(listBox1.SelectedIndex*24));
Kill.dwstate = MIB_TCP_STATE_DELETE_TCB;
// iterate the pointer of 4
current = (IntPtr)((int)current+4);
Kill.dwLocalAddr=(int)Marshal.ReadIntPtr(current);
current = (IntPtr)((int)current+4);
Kill.dwLocalPort=(int)Marshal.ReadIntPtr(current);
current = (IntPtr)((int)current+4);
Kill.dwRemoteAddr=(int)Marshal.ReadIntPtr(current);
current = (IntPtr)((int)current+4);
Kill.dwRemotePort=(int)Marshal.ReadIntPtr(current);
IntPtr pt=Marshal.AllocHGlobal(Marshal.SizeOf(Kill));
Marshal.StructureToPtr(Kill,pt,true);
IPHelp.SetTcpEntry(pt);


problem 2 : What event happen when a port is opening.Is there any
message that I hook on it.



thanks

GeneralRe: Closing Tcp connections // (for Axel Charpentier) Pin
Heath Stewart21-Jul-04 6:34
protectorHeath Stewart21-Jul-04 6:34 
GeneralProblems with program start and install Pin
arjasepp21-Jul-04 0:51
arjasepp21-Jul-04 0:51 
Generalconvert XML X.509Certificates Pin
pelos21-Jul-04 0:47
pelos21-Jul-04 0:47 
GeneralRe: convert XML X.509Certificates Pin
Heath Stewart21-Jul-04 6:32
protectorHeath Stewart21-Jul-04 6:32 
GeneralRe: convert XML X.509Certificates Pin
pelos21-Jul-04 6:54
pelos21-Jul-04 6:54 
GeneralRe: convert XML X.509Certificates Pin
Heath Stewart21-Jul-04 9:17
protectorHeath Stewart21-Jul-04 9:17 
GeneralRe: convert XML X.509Certificates Pin
pelos21-Jul-04 12:50
pelos21-Jul-04 12:50 
GeneralThreads and UI Pin
LukeM21-Jul-04 0:27
LukeM21-Jul-04 0:27 
GeneralRe: Threads and UI Pin
Gary Thom21-Jul-04 3:31
Gary Thom21-Jul-04 3:31 
GeneralA generic error occurred in GDI+ Pin
Member 94012520-Jul-04 23:39
Member 94012520-Jul-04 23:39 
General? Open an already opened file Pin
catalin_im20-Jul-04 23:09
catalin_im20-Jul-04 23:09 
GeneralRe: ? Open an already opened file Pin
Colin Angus Mackay21-Jul-04 0:51
Colin Angus Mackay21-Jul-04 0:51 
GeneralRe: ? Open an already opened file Pin
Heath Stewart21-Jul-04 6:24
protectorHeath Stewart21-Jul-04 6:24 
Generallock table in ms sql Pin
evoseven20-Jul-04 22:38
evoseven20-Jul-04 22:38 
GeneralRe: lock table in ms sql Pin
Nick Parker21-Jul-04 3:09
protectorNick Parker21-Jul-04 3:09 
GeneralRe: lock table in ms sql Pin
Steven Campbell21-Jul-04 3:16
Steven Campbell21-Jul-04 3:16 
GeneralRe: lock table in ms sql Pin
evoseven21-Jul-04 13:17
evoseven21-Jul-04 13:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.