|
-
Feb 27th, 2012, 12:13 PM
#1
Thread Starter
Junior Member
Sockets, New Empty Sockets
Hi everybody, I'm trying to make a "undefined" socket.
What i mean with undefined is that it will only contain:
PACKAGE:
Destination:Mac to send to: Length:0x6
Source:Mac that is sending this package: Length:0x6
Type:I want to define it: Length:0x2
then i will add some data to send here(not necessary for now).
This is my code right now:
Code:
Private Sub SendData()
Dim rClient As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
'Make Data to send, not package header!
Dim buffer() As Byte = MakeReq(b_mac, sOpt.mac, sOpt.ip, sOpt.mac, MakeTIp(1), n_mac)
rClient.EnableBroadcast = True
Dim _ip As EndPoint = New IPEndPoint(IPAddress.Broadcast, 4950)
rClient.SendTo(buffer, _ip)
end sub
If I monitor my network with Wireshark i will now get somthing like this:
Destination: good
Source: good
Type: bad! it is 0x0800 (IP)
then i get a section that is called IPv4 with some data
Then i get a section of data that is called User Datagram Protocol(UDP)
then i get my DATA
I want the IP and UDP section removed and I want to change the Type value
Please help, I have tried to Google it but failed! I have tried everything I can, Please help me. 
-
Feb 27th, 2012, 12:17 PM
#2
Re: Sockets, New Empty Sockets
First of all I can't imagion why you would want to remove that stuff and second I don't see how it could work without it.
-
Feb 27th, 2012, 12:19 PM
#3
Thread Starter
Junior Member
Re: Sockets, New Empty Sockets
 Originally Posted by DataMiser
First of all I can't imagion why you would want to remove that stuff and second I don't see how it could work without it.
It need to work!
If you look at the ARP package for example you will see:
Destination:MAC
Source:MAC
TYPE:0x0806(ARP)
then some data
That is it. But how?
-
Feb 27th, 2012, 12:20 PM
#4
Re: Sockets, New Empty Sockets
Can you explain a bit more about the purpose for this? From your description, it sounds like you want to send something without that packet having any information about what it is. I'd be amazed if that was possible, as I would expect that routers would find it difficult to know what to do with such a packet, nor can I see any value to doing that. Therefore, if you explain why you want to do that, perhaps we could suggest a better approach to solving the ultimate problem.
My usual boring signature: Nothing
 
-
Feb 27th, 2012, 12:21 PM
#5
Re: Sockets, New Empty Sockets
Ah, I was writing as you were posting that. So you want to get rid of the UDP part and just have the IP part?
My usual boring signature: Nothing
 
-
Feb 27th, 2012, 12:27 PM
#6
Thread Starter
Junior Member
Re: Sockets, New Empty Sockets
 Originally Posted by Shaggy Hiker
Can you explain a bit more about the purpose for this? From your description, it sounds like you want to send something without that packet having any information ...
There is no good purpose of this I only do this because I want to learn how this stuff works in the base.
What i will do with it later on is to broadcast to all on my network(you can see it in my code) and they will listen for my protocol and not any other.
-
Feb 27th, 2012, 12:28 PM
#7
Thread Starter
Junior Member
Re: Sockets, New Empty Sockets
 Originally Posted by Shaggy Hiker
Ah, I was writing as you were posting that. So you want to get rid of the UDP part and just have the IP part?
I was writing too...
No the IP will be removed to not IPv4 or IPv6 only a clean package
-
Feb 27th, 2012, 12:48 PM
#8
Re: Sockets, New Empty Sockets
You might want to look into the IP stack in general. I have a book that discusses all the different layers that go into making up any packet. It's fairly involved.
However, I'm not sure that you will be able to work with any modern switch and not have at least the IP layer in there, since I think the switches are using that, even if you have some custom layer above that. On the other hand, it has been years since I have looked at that, so I'm probably at least out of date if not flat out wrong.
My usual boring signature: Nothing
 
-
Feb 27th, 2012, 12:51 PM
#9
Re: Sockets, New Empty Sockets
Have you experimented with different socket types? Protocol types?
-
Feb 27th, 2012, 12:54 PM
#10
Thread Starter
Junior Member
Re: Sockets, New Empty Sockets
 Originally Posted by DataMiser
Have you experimented with different socket types? Protocol types?
I'm working on it right now, I'm making a brute force that will look if it is possible with that combination of Addressfamily + SocketType + ProtocolType
-
Feb 27th, 2012, 01:17 PM
#11
Re: Sockets, New Empty Sockets
It sounds like you want to send/receive raw ethernet packets. I've not done it myself, but try using the SocketType.Raw for the protocol type.
"Ok, my response to that is pending a Google search" - Bucky Katt.
"There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
"Before you can 'think outside the box' you need to understand where the box is."
-
Feb 27th, 2012, 01:18 PM
#12
Thread Starter
Junior Member
Re: Sockets, New Empty Sockets
 Originally Posted by SJWhiteley
It sounds like you want to send/receive raw ethernet packets. I've not done it myself, but try using the SocketType.Raw for the protocol type.
I think that too but, what does the other values need to be?
-
Feb 27th, 2012, 01:28 PM
#13
Re: Sockets, New Empty Sockets
 Originally Posted by DataMiser
Have you experimented with different socket types? Protocol types?
I've only really been a particular fan of UDP, though I have also used TCP.
My usual boring signature: Nothing
 
-
Feb 27th, 2012, 02:12 PM
#14
Re: Sockets, New Empty Sockets
I used a little UDP back in VB3 when I was first learning the winsock. Now I use TCP in pretty much everything.
-
Feb 28th, 2012, 01:04 PM
#15
Re: Sockets, New Empty Sockets
Well, from the start of your post it seems you want to simply send ethernet packets (MAC to MAC). by setting datagram and UDP, you are sending UDP packets over IP - neither of which you want.
Your following code indicates an IPEndPoint object - well, since you don't want IP, you can't have an IP end-point. You aren't talking IP.
If this is raw ethernet packets, try SocketType.Raw and ProtocolType.Unknown. I am not sure if this will work, but give it a try.
However...
Do you really want raw IP packets? Both UDP and TCP are built on - wrappered by - IP. You can set the SocketType to Raw and ProtocolType to Raw. The documentation implies this is raw IP protocol.
Again, i cannot be sure of these as I've only used UDP and TCP for socket communication. You will possibly need to experiment with the settings, and understand what ethernet protocol you are actually dealing with.
"Ok, my response to that is pending a Google search" - Bucky Katt.
"There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
"Before you can 'think outside the box' you need to understand where the box is."
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|