C++ Sending Structs Over Sockets
Aug 25, 2009
i am using vb.net and i would to send some structs to a C++ tcp server.The problem is the structs i am sending might contain other structs.[code]Lets say i want to send FirstStruct over to the C++ Server.
View 2 Replies
ADVERTISEMENT
Aug 20, 2009
I am using Nektra's Deviare to hook winsock's send method calls. My ideia is to learn to also send messages through the same socket than the original application. So what I'm doing is when i detect the first call to send message, I save the socket id(the first argument of the send function), so I can use it later.
So here is my code:
uint socket = 0;
[DllImport("Ws2_32.dll")]
private static extern int send(uint socket, string buf, int len, int flags);
[Code].....
This last messagebox is poping up always -1. Why should be it?
edit: calling WSAGetLastError() returns 2. Which I do not know what it means, as it doesn't seem to appear on msdn.
View 3 Replies
Apr 14, 2010
I know there are lots of examples here on the forum, but all to difficult to understand.I have a client:
I have a client:
Imports System.Net.Sockets
Imports System.Text
[code].....
View 1 Replies
Jun 11, 2011
i want to send an multiple screenshot image.. and i want them to send one by one from my client to server. im using vs2008.
View 1 Replies
Jun 2, 2009
VS 2008: Send commands to a local UDP port. The port is 5975. Let me know if im being to vague or you need more info.
View 3 Replies
Aug 2, 2011
i'm lost on how to do this inline.It's easy to say
Dim X as Integer = new Integer(4) {1,2,3,4}
but i'm lost on:
Structure ThisType
[code]....
View 3 Replies
May 3, 2011
I'm really struggling with the following pinvoke call. I've tried numerous different ways of doing this but still no joy. The call runs through, but I get a 'Bad parameter' message back with suggests there is something wrong with the struct, since I've ran through a c++ example of this code and the parameters are all correct.
[Code]...
View 1 Replies
Dec 2, 2009
I'm working on some interpo between VB6 and VB.NET and I've hit (another?) brick wall.I need to pass an array of "stuff" between VB6 and VB.NET. This contains an ADO recordset and 4 string values. There could be any number of these 5 items passed, so they will have to be an array of whatever.Seemed to me that in VB I should create a Type and in .NET a Struct, then it should be easy. However...
On running the VB app it fails to start with an error "Function or interface marked as restricted, or the function uses automation type not supported in Visual Basic"
[Code]...
View 5 Replies
Apr 30, 2012
I need assistance generating a xml file by reading values from an array of structs.
my struct looks like this:
public structure myStruct
dim ID as int
dim myArray1 as boolean
dim myArray2 as boolean
dim myArray3 as boolean
dim x as int
dim y as int
I have several instances of these structs. I also have universal variables that are declared outside of the structs. I am looking to generate a xml file like this:
[Code]...
But how would I assign the values of each element by reading them in from the struct? Or do I need to use the XmlSerializer Class instead?
View 1 Replies
Jul 22, 2009
That is the question. Is there anything you can do with c++ unions that you can't with c# Explicit structs?
View 3 Replies
Mar 22, 2009
I have an assignment where I must read the information from a text file into an array of structs, so that when a part number is input, the correct price will be displayed.
the file is a text file named shoeinfo.txt
it looks like this: BZB34,40.99
BZJ25,54.50
JMM97,14.99
[Code].....
unfortunately I am unable to figure out how the code is to be read into the array. i.e. item(0).partnum = BZB34 item(0).price = 4099D
View 4 Replies
Apr 1, 2009
I have been searching for a while now, but I still can't seem to figure this out. I wrote a rather large program, and to make things more efficient I started to create structs to store more info in a variable.All was well replacing my old code with new code, till I reached a certain point and found that blindly using a loop of integers to access the indexes of the array wouldn't work anymore... I need to access a specific struct by the information contained in a single variable within the struct (like a hashtable key), but can't seem to figure out how.
Is it possible for me to go through my array indexes in a fashion like this?:
Dim myArray(TableCount) As myStruct
Dim TableName As String = "SomeTable"
[code].....
View 2 Replies
Oct 28, 2011
I would like to store references to a bunch of structs in a collection. The general scaffolding looks like this:
Structure myStructType
Dim prop1 as String
Dim prop2 as int
End Structure
[Code]....
now this doesn't work, because it's referencing the same memory. What I would really want is the 'pass reference by value' behaviour that is also used for reference types, so that I can easily keep producing more of them.
Is there any way to fix this other than to make the structs into classes? Is this actually a proper way to use structs, or do I have it all wrong?
View 1 Replies
Dec 8, 2009
I just converted the following code from c# to vb.net. It is functional and works correctly with my company's firmware/devices. My next challenge. Previous serialport code used much more readable structs which where then converted (after building a packet) into byte() automatically as part of the serialport encoding. (this is my understanding)How could I
1. morph byte arrays 'ToSocket' and 'ToMTP' below into structs and
2. convert into byte array for Socket.BeginSend(byte(),.....) to stream out to remote devices?
Imports System.ComponentModel
Imports System.Text
Imports System.Net.Sockets
[Code]....
View 3 Replies
May 27, 2012
I am trying to Send an Email with an attachment (using Gmail) but I keep getting errors like "Operation Timed out" or Failure Sending Email". It was working earlier today but I found out that i needed to add Using statement because the email was having a file open that had to be deleted after it was sent but afterwards it doesn't work.
Here's what I have (Portion of it):
Private Sub SendMailOneAttachment(ByVal un As String, ByVal pass As String, Optional ByVal smtp As String = "smtp.gmail.com")
Using oAttach As Net.Mail.Attachment = New Net.Mail.Attachment((Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\" & My.Computer.Name & "_" & fName & " .zip"))
Dim client As SmtpClient = New SmtpClient(smtp)
[Code] .....
The ports are correct I believe, no firewall up on my PC...
View 1 Replies
Mar 4, 2010
Which is better for Sending Files/Sending Images/Msg for P2P Chat?
View 1 Replies
Jul 13, 2010
I am tring to send e-mail used VB 2008. Below is my code. The error message I am getting is "5 Failure sending mail at System.Net.mail.client.send(MailMessage message).I have two questions. 1.) What am I doing wrong? & 2.) Is there a way the get a more description error message.
message As
New System.Net.Mail.MailMessage
Dim mySmtpsvr[code].....
View 2 Replies
Feb 17, 2010
I am writing an application which involves reading xml over socket. The messages arrive at socket asynchronously. How can I ensure that data is received in form of complete xml elements, validate received data and which classes will be helpful for me in accomplishing my goal.
View 1 Replies
May 21, 2012
Can i implement PTP (precision time protocol) or NTP (simple network timing) with sockets?
If so, how can i use them to send small packages (4 to 33 bytes) with the smallest delay possible?
P.S. I would prefer to know more about PTP, I've heard that it has smaller delay.
View 1 Replies
Jun 2, 2011
I have an application in vb.net which will connect with an hardware device and test its functionality. The hardware device basically spits out data continuosly through Ethernet. That is it recieves some data via com ports and spits out the processed data via ethernet.So my application does both. Thats pretty much the entire app.My problem is i am using tcpclient sockets. Now when i connect a tcpclient to the device using
tcpclient.open(ip,port);
Immediately the device sends some data which comes and get stored in the clientsocket. Then i send a command to it ,only then i read the data from the clientsocket using
tcpclient.getstream().read()
at this time the entire data that is the one which flowed immediately when connected to the device and the one that i actually need after passing command is both acquired. This is undesirable. I need the data which i read only after sending the command. So i was wondering if there is any way to clear the tcpclient socket before we do a read. The manual doesnt show any such method.
View 1 Replies
Sep 29, 2009
Here is an issue with a socket I am having:
Public Sub Connect(ByVal server As String, ByVal port As Integer)
Dim IP As IPAddress = IPAddress.Parse(server)
Dim EP As IPEndPoint = New IPEndPoint(IP, port)
[Code]....
The socket is declared like this, at the top of the code:
Dim sock As Socket
What is wrong here? It says Object reference not set to an instance of an object, which is a NullReferenceException.
View 1 Replies
Mar 4, 2009
I am actually new to VB.net...i have managed to create Sockets and communicate over them..but i dont know how fire sql queries through sockets as they take in Byte data as a input...i want to actually pass queries through sockets and retrive those results...i am using mysql database....i have actually tried changing the connection string (the ip address) for a static network but i think sockets are better for dynamic ip networks.
View 1 Replies
Nov 25, 2011
Net.Sockets wait for streamwrite?
View 2 Replies
Feb 18, 2003
This code will allow you to send Emails using only .NET Sockets. This code was adapted from sample code on[code]...
View 7 Replies
Jun 16, 2009
So basically I would like to know what goes on behind smtpclient, webrequest and all those.
I would like to know if its possible to connect to an smtp server with sockets. Also, can anyone recommend a good OOAD(object oriented analysis and design) tutorial or book?
View 2 Replies
Jan 3, 2011
I'm building a program that has a very basic premise.
For X amount of Objects
Open Conection
Perform Actions
[code].....
View 2 Replies
Mar 11, 2011
Do you all have any updated websites that provides tutorials about the system.net.sockets namespace?
View 1 Replies
Feb 23, 2011
I have a chat program using System.Net.Sockets.Socket that works perfectly over LAN.My question is - will this same program work over the net with little or no modification and if so do i provide the client with the IP of my machine or of my router and use port forwardin
View 1 Replies
Nov 9, 2009
I'm using System.Net.Sockets namespace for connecting to an ftp server. If a user has to login to a firewall first though, I'm not too sure what to do. The following is what I have working for logging into an ftp server without a firewall. (The Else statement) Do you know what I might add to the if statement? In the method where this conditional is, I am passing a firewall username and password.
m_tcpClient = New TcpClient
' Try to connect to ftp site
' If using firewall, login to it first then issue another command to log in to actual
[code]....
View 6 Replies
Oct 15, 2011
I made a TCP server which communicates with multiple clients at once, but I can't seem to be able to make them stable. When one of the client sends 100 packets to the server, the server receives only a few of them.Here's the client code in PasteBin. It shows how the client connects to the server and then sends 100 messages in a For loop to the server.And here's how the server handles the connection. I couldn't paste the full source as it's hundreds of lines long so let me know if it's missing any mandatory parts and I'll upload them as well.
View 1 Replies