Wrox Programmer Forums
|
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 18th, 2009, 10:12 AM
Authorized User
 
Join Date: Jul 2009
Posts: 20
Thanks: 0
Thanked 1 Time in 1 Post
Default NetBios and Net Send

Hi everybody,

I have a problem receiving Net Send messages.

I want to 'intercept' and message using NetBios API. Has anybody an idea how this can be done?

Greets
 
Old November 18th, 2009, 11:05 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

AFAIK there is no built in functionality in the framework to do this which means you are going to have to do a p/invoke to work with the actual Win32 API.

This site has most (all?) of the C# and VB.NET signatures necessary to do p/invoke with the Win32 apis
http://www.pinvoke.net/default.aspx/netapi32/

An example
http://www.csharphelp.com/archives2/archive440.html

hth
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
 
Old November 19th, 2009, 10:04 AM
Authorized User
 
Join Date: Jul 2009
Posts: 20
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Doug,

thank you for your reply.

I know how to include the API but the API has 322 functions and I do not know the function that accepts or reads or does what so ever with net send message I want to catch.

Has anybody any idea? I found a functions called:

296 127 0000EDE4 NetpNetBiosReceive
297 128 00016370 NetpNetBiosReset
298 129 0000F56C NetpNetBiosSend

But I do not know what exactly they do. Has anybody ever used any of these functions?

Last edited by 4thhorseman; November 19th, 2009 at 10:09 AM..
 
Old November 19th, 2009, 10:16 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

To send messages you will need to import:
http://www.pinvoke.net/default.aspx/...sageBufferSend

To intercept, now that might be a bit tricky. AFAIK the ability to read incoming Net Send messages is handled by the Messenger Service. You could turn this service off and then write your own service that would monitor the Net Send ports and then do what you need to do from there.

hth
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
 
Old November 21st, 2009, 11:21 AM
Authorized User
 
Join Date: Jul 2009
Posts: 20
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey Doug,

thanks again for replying.

I read something about a HttpListener class written in C#. Can I assign a different port than 80? I am thinking about the messanger port which is about 135.
The Following User Says Thank You to 4thhorseman For This Useful Post:
youtubeline (November 21st, 2009)
 
Old November 23rd, 2009, 09:19 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Unless you are doing something Web Based I would not use an HTTP Listener. Before we go any further let me ask you some questions:

-When you say "intercept" do you mean you are trying to read all NETSend messages going over a network or just the ones coming to your machine?

-Do you have Admin access to the machine that you want to read NetSend messages from?
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
 
Old November 23rd, 2009, 01:57 PM
Authorized User
 
Join Date: Jul 2009
Posts: 20
Thanks: 0
Thanked 1 Time in 1 Post
Default

I want to read a net send message from only one other computer in the same network.

Yes I have administrator rights on the machine.
 
Old November 23rd, 2009, 02:02 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Sounds like you need to look into using Sockets. This link should help you: http://www.switchonthecode.com/tutor...ded-tcp-server

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
 
Old November 23rd, 2009, 02:45 PM
Authorized User
 
Join Date: Jul 2009
Posts: 20
Thanks: 0
Thanked 1 Time in 1 Post
Default

I read about sockets, but I believe that using a socket-server needs a socket client to connect to.

I cannot write a client socket app on the machine that sends the net send message.
 
Old November 23rd, 2009, 02:53 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I could be wrong, but I am pretty sure if you bind a TCP Listener to the port you are interested in you could get a handle on the Network Stream coming across the port on the target machine.

-hth.
Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send mail with vb.net Koeno VB How-To 4 July 20th, 2008 05:01 AM
How to send the mail in ASP.NET n.nsivakumar ASP.NET 1.0 and 1.1 Professional 2 July 26th, 2006 03:49 PM
send MASS Emails in ASP.NET 2 with VB.NET 2005 alexdcosta ASP.NET 2.0 Basics 1 July 17th, 2006 12:31 AM
getting a net send gbianchi Pro VB 6 9 September 3rd, 2005 10:31 PM
Send message on Local net qazi_nomi Classic ASP Basics 3 October 26th, 2004 02:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.