Solved

Sending Winsock UDP packet problem

Posted on 2003-11-04
9
678 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 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