473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Sniffing at two sockets

In a simple VB script I open ADODB.Connection and start sending
some very simple T-SQL commands to a MS SQL Server. Like this:

------------------------------------------------------------

Set cn = CreateObject("ADODB.Connection")
cn.Open _
"Provider=sqloledb;Data Source=127.0.0.1,1434;" & _
"Network Library=DBMSSOCN;Initial Catalog=pubs;" & _
"User ID=qwe;Password=asdasd;"

cn.Execute _
"select 'XXXXXXXXXXXX';" & _
"waitfor delay '00:00:03'; raiserror ('AAA',10,1) with nowait;" & _
"waitfor delay '00:00:03'; raiserror ('BBB',10,1) with nowait;" & _
"waitfor delay '00:00:03'; raiserror ('CCC',10,1) with nowait;" & _
"waitfor delay '00:00:03'; select 'YYYYYYYYYYYY';"

------------------------------------------------------------
BUT I do it (sending to\fro data) via two sockets opened in a python
code. Note: in above connection string I direct VB script to port 1434,
BUT the SQL Server listens to its default port = 1433.
Here my python code:
------------------------------------------------------------

import socket
host, port = '127.0.0.1', 1434
s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s2.connect((host, 1433))
s1.bind((host, port))
s1.listen(1)
cn, addr = s1.accept()
while 1:
data = cn.recv(4096)
if not data: break
s2.send(data)
print 'VB_SCRIPT:', data
data = s2.recv(4096)
if not data: break
cn.send(data)
print 'SQL_SERVER:', data
cn.close()
s1.close()
s2.close()

------------------------------------------------------------
And in the 0-approximation everything works just fine! I can
see printed intercepted requests\replies from VBS\SQLServer.
BUT alas it does not work EXACTLY as it works if the VB script
"connects" DIRECTLY to the "true" SQL Server's port = 1433.

After receiving the first error_message 'AAA' the VBS should
immediately issue something like 'Ready to receive next packet'
(in my newbish understanding), BUT instead it gets frozen till
its CommandTimeout times out and only then it wakes up, issues
a final request and gets ALL data that SQL Server "accumulated"
for the client's side; namely, error_messages 'BBB' and 'CCC'
and result of "select 'YYYYYYYYYYYY'".

ANY IDEAS WHY IT WORKS NOT QUITE CORRECTLY WILL BE GREATLY
APPRECIATED!!!

Jul 19 '05 #1
0 1805

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tero Saarni | last post by:
Hi, I have several threads communicating with each other using events stored in Queues. Threads block on Queue.get() until somebody publishes an event in thread's event queue. I need to add...
11
by: James | last post by:
I wasn't sure where to post this so I'm sorry if this is the wrong place. But I would like to know what some of the differences are between client-side and server-side browser sniffing. I'm aware...
4
by: BadOmen | last post by:
Hi, What is the different between 'System.Net.Sockets.Socket' and 'System.Net.Sockets.TcpClient'? When do I use System.Net.Sockets.TcpClient and System.Net.Sockets.Socket?? Yours, Jonas
3
by: Michael Maercker | last post by:
hi! i'm really not into networking at all and have now been asigned the task of porting a vb6-code into vb.net (compact framework, in this case) and the code uses the winsock-control. i quickly...
3
by: J C | last post by:
Hi, I'm using UDPClient to make a simple DNS server. I notice that intermittently and unpredictibly I get: Unhandled Exception: System.Net.Sockets.SocketException: An existing connection...
16
by: petermichaux | last post by:
Hi, Does anyone have a a cross-browser setOpacity function that does not use browser sniffing? I looked at the Yahoo! UI function and it detects IE by looking for window.ActiveXObject. I also...
1
by: RobG | last post by:
Browser sniffing is generally considered a very bad idea, developers are usually told that feature detection is the way to go. It seems a real pitty then that the developers of new platforms are...
1
by: Ken Fine | last post by:
I have been investigating programmatically downloading FLV content from various sites ("video scraping"??) Many interactive GUI tools do this, such as the Orbit downloader. At the heart of them...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.