Sending A File Over Sockets?
Apr 14, 2010I 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].....
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].....
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.
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 Repliesi 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 RepliesVS 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 RepliesDownload file asynchronous using sockets
View 8 RepliesI am very new to VB.Net, and I am trying to write a program that will write to a text file on another computer (the program is going to be running on a windows ce device). I have created the socket from an example, but it is not working. I am getting a first chance exception, but also, I just don't really know if it has connected or not. I have attached the code below:
[Code]...
I like to compress the xmldata before the data is provided to the client as an excel file. I am trying to compress and deliver it as a .zip file. its not working Here's my code below. I tried compressing it, converting it to bytes etc etc. The issue with below code is, the XSL transformation is not happening properly and the output excel file is raw xml with some .net exception at the end. (that's what I see on the .xls file that's downloaded at the end) Before I started working on compression my below code was working fine that gives properly formatted excel file from the xml input. the excel file is so nice you can't even tell it was from XML.
[Code]...
[code]...
Im not talking about a database...Just a way to send files from one computer to another.
I have only finished about sending string via COM.
View 3 RepliesI have an XDocument ready to be sent out via Network stream, what do I need to get it working? I am connected via networkstream and can send regular text, but I don't know how to send an XML Document, I use the networkStream.write() function to send in text.
View 2 RepliesI need to send text from 2 text boxes(TextBox1 & TextBox2) to a .txt file on seperate lines.
View 7 RepliesI 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...
Im new with vb2008 and i wanted to know if i file is in use before sending it via ftp
View 2 RepliesA certificate is required to complete client authentication.I am sending an XML file to a remote server.[code]
View 1 RepliesI have created window service and one window application which is running as notify application in VS2010 using vb.net both are different project.
I want to pop up message in notify application when window service download some file to local system.
means,i want to send message to notify application when ever window service application download file to local system.
I have made a program that makes a text file and then sends it to my msn account using my gmail account. It works fine the first time but the second time it says that the text file is being used by another process?![code]
View 2 RepliesWhich is better for Sending Files/Sending Images/Msg for P2P Chat?
View 1 RepliesI'm making a windows form.Here is my current code:I don't have any idea on how to link the open file dialog with the file that I am going to attach.
Try
With OpenFileDialog1
'OpenFileDialog1
[code].....
I didn't saw much samples about tcp file share. They look similar to what I am using to send string. My question is : Does these codes work with any kind of files? And May I have some hints about how to do it?
View 1 Repliesi am currently using this code to delete folder files.
For Each itm As String In ListBox1.Items
Try
My.Computer.FileSystem.DeleteFile _
[Code]....
what i am having problems with is that if a file is in use, i get a msgbox prompt.. i do not mind it not deleting the file. how can i bypass that msbox to not show??-.trujade.-
I need some help sending the contents of a listbox to an output text file. Is there any code is visual basic that will allow me to do this.
View 13 RepliesI need to send a switches and a filename to a command line application.First I'll need to get a collection of files that can range from 0 to an infinite amount.Then I can start the process with the correct switches. Normally, within the command line application, I would specify the specific filename and send it as an argument to the application.However, I'm not sure how I would do this. The names of the files have to be preceeded by a specific switch. I can't remember the switch right now, but we'll call it [b]-f[/f].[code]So, I need to figure out how to send all or each of the file names as an argument.
View 1 RepliesI've implemented with Visual Basic 10 an application for Net Framework 4 with functionality to send files via e-mail using System.Net.Mail. It works well except when it comes to sending an XML file whose name contains accents. In the latter case the UTF-8 name is not correct, so Widows Mail Life presents him with name consisting of a set of meaningless characters. Furthermore, the content has lost the format of lines and spaces, presented part of MIME type information in the header, so that it is unreadable XML readers. However, with a name without accents is sent successfully.[code]....
View 3 RepliesI am currently working a piece of code which needs to send an attachment in the
email it generates. The attachment is a PDF document. Due to requirements I am
unable to save the PDF and send it, so I have had to create a memory stream attachment.
The issue I have with this is that the file size is _500KB. However save the file on my machine and it is around 370KB.
This increase in file size is unacceptable. has anyone come across this issue before? If so how have they got round the problem.
Below is the section of code.
Dim memStream As System.IO.MemoryStream = Nothing
'assign number to the PDF name
Dim filename As String = req.GetAccountNumber()
[Code]....
I am using VB.net code and SQL server 2005.I am havng below code for sending email in my vb.net code.
Protected Sub ibtnSendInvites_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ibtnSendInvites.Click
Try
Dim emailList As New List(Of String)
For Each curRow As GridViewRow In GridView1.Rows
[code].....
Now my problem is that some time if emailaddress is not valid or SMTP server is responding my application get hangs. I want to log my errors generated by my SMTP server in table or any log file it would be good if I can send back email to admin with the details of error occurred.
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].....
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 RepliesCan 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.
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.