• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1242
  • Last Modified:

Killing outgoing TCP sessions

Hello all,

We have a windows 2003 server. This server is running some scripts for the clients. Theese scripts are leaving connections open, to much connect. Windows Xp cannot have more then 10 server connections.

What I want , I want to kill all TCP connections as quick fix. I can do this though disabeling and enabling the network card or rebooting.
I want to disable and enable scripted the network card. But I don't know how.

As final solution we will rewrite all the script to resolve all problems, but this takes to long.

PLease help me..
0
Nostradamuz
Asked:
Nostradamuz
2 Solutions
 
Darwinian999Commented:
If the clients are using DHCP, you could try the following:

ipconfig /release
ipconfig /renew

If that doesn't work, you'll need to use netsh - http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/netsh.mspx
0
 
TheCleanerCommented:
You are saying that the script connects to an XP machine, and the XP becomes the "server connection" at that point?  Which is why you are limited to 10 client connections to that XP box, right?

Just making sure, since you are also talking about 2003 server in your post.


Any script that will disable and renable the NIC obviously has to be run locally on the XP workstation in question, since once you disable it, you won't be able to re-enable it remotely (since you won't be able to get to it).

That said, here's two scripts.  One using simple net commands, the other vbscript.  All that needs to be done is to stop and start the Server service on the XP workstation.  That will kill any client connections to that box.


SCRIPT #1: (save as batch file and run on the XP machine.)

net stop server
net start server


(that's it, lol)


SCRIPT #2: (save as .vbs and run on the XP machine)

Option Explicit
Dim objShell, intShortSleep, intLongSleep
Dim strService
Set objShell = CreateObject("WScript.Shell")

' Values set
strService = " Server"
intShortSleep = 1500
intLongSleep = 5500

' Cmd prompt opened
objShell.Run "cmd"
Wscript.Sleep intShortSleep

' Service stopped with 'Net' command
objShell.SendKeys "net stop" & strService
Wscript.Sleep intShortSleep
objShell.SendKeys "{Enter}"
Wscript.Sleep intLongSleep

' Service started with 'Net' command
objShell.SendKeys "net start" & strService
Wscript.Sleep intShortSleep
objShell.SendKeys "{Enter}"
Wscript.Sleep intLongSleep

' Cmd prompt exited
objShell.SendKeys "Exit"
Wscript.Sleep intShortSleep
objShell.SendKeys "{Enter}"

Wscript.Echo strService & " service restarted"
WScript.Quit

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now