Solved

Sending Winsock UDP packet problem

Posted on 2003-11-04
9
677 Views
Last Modified: 2013-12-26
Hi, I'm ted

I got this little dilemma that I was hoping you could help me with.  I am writing a visual basic app that uses a Winsock control to send a UDP packet to my server containing a string "status".  This then provokes a response telling me the server information needed. The problem I have is that it will only send the response back to the workstation that sent the packet. I want to be able to manipulate the UDP packet with the source address of say my other box so that another box on my network gets the response. In short I want a program where i can send status from a workstation, and have the response sent to my other workstations. Sending UDP packets with different source addresses and i am not sure how to go about coding this, the UDP packet itself works perfectly.

Sorry if this is a bit long winded, I found it hard to explain.

Any help would be most appreciated , especially code

Kind regards

Ted
0
Comment
Question by:tedcrowley
  • 3
  • 2
9 Comments
 
LVL 9

Accepted Solution

by:
Dang123 earned 65 total points
ID: 9686576
On the server, is it a program you wrote that is responding to your UDP packet or the Windows system itself.

If it is a program you wrote, you could have it send out the information in a broadcast instead of just to the originator. If it is code outside your control you could have you program listen for the response after sending the UDP packet and broadcast the information itself, sort of like a relay (you would probably want to include the name of the server in the broadcast incase you apply this to more than one in the future).

Here is a link that would help you with sending the broadcast

http://abstractvb.com/code/code685.asp
0
 

Author Comment

by:tedcrowley
ID: 9686824
Hi dang I'm Ted,

Thanks for the prompt reply, I neglected to tell you that it is a piece of software that is being sent the status packet and i have no control over this commercial program.  I was hoping that it would be possible to assign a different source address (IP address) than the computer I am sending the UDP packet from so that another computer on my network receives the status response (packet reply).

In all honesty I would rather not adhere the broadcast methodology because the packet will be received by many workstations. Consuming our much needed bandwidth.
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9686940
Ted,
    The address is placed by TCP/IP, I don't think you can change it without getting into the low level workings of the protocol. You could let your program receive the response and relay it to the other machine(s).

Dang123

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:tedcrowley
ID: 9687302
Hey dang so I guess it's impossible to create the underlying of the UDP packet in VB, as you can in say C? When you build the UDP and IP header of the packet?
0
 
LVL 5

Assisted Solution

by:dc197
dc197 earned 65 total points
ID: 9724035
No, not impossible.
But the beauty of MSwinsck.ocx is that it takes care of it all for you.

If you need low level IP packet manipulation, the winsock control is not for you.
0
 
LVL 9

Expert Comment

by:Dang123
ID: 10431876
Sudgest split between Dang123 and dc197
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now