|
bhargavichow wrote: I expected it to fail, mail delivery for only the wrong mail addresses and it should be succeed for correct one.
Seems like you were wrong then. Did you have a question, or was this just an observation?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
I am working on a chatting project witch is to work using C# Sockets. There are two segments "Server" and "Client" as usual. I tried it on a local network and the result is with 5 systems in my lab, it is working nicely and on making a system Client and any one Server , we became able to have our conversations but with rest of two systems story is not same. When I am making my PC server and another one client , it is working but when I am keeping Client and making other one server it is not working and generating following exceptions:
"A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond + C# socket program"
If it is working with other PC of the LAB nicely than why it is not working with only 2 PCs.
Structure is as :
Server picks IP and port of the system on which it is running that is like :
IP : 192.168.0.13
Port: 8000
On the Client PC We need to give IP of our Server and a port number, that is like
IP : 192.168.0.13
Port : 8000
Can any one tell me why is this happening .
Hemant S. Adhikari
|
|
|
|
|
Is there a firewall in place? Are the two PCs on the same network? The IP addresses given are on an internal range so if the connection crosses the internet it won't work, you need an external IP address.
|
|
|
|
|
Can you post the code that you have? If not, you can check out the code on this page (http://msdn.microsoft.com/en-us/library/w89fhyex.aspx). I would advise going through this page first. It provides good, working examples of client server sockets.
Hope this helps ,
Prateek
|
|
|
|
|
I have a Datagridview which has a Datagridviewcombobox column and an integer column for which the values are autogenerated by me.
The combobox is added like this
DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn();
col.Name = "Category";
col.DataPropertyName = "Category";
col.Items.AddRange(new string[] {"value1", "value2", "value3"});
this.datagridview1.Columns.Insert(1, col);
The combobox column works properly only when the VirtualMode property is false.
I have a serial no column, whose value is generated automatically in in datagridview_NewRowNeeded event like this:
this.datagridview.Rows[this.datagridview.Rows.Count-1].Cells[0].Value = something...
This event works only when the VirtualMode property is set to true.
Is there any workaround to achieve both these in the same datagrid?
Cheers
CNU
|
|
|
|
|
|
Check the link
[^]">
Cheers!!
Brij
|
|
|
|
|
i want to set the datatime picker visible and unfold at once when the user clicks on a button,up to now i can onlt set visible true/false only, what is the event i should call to unfold the datetime picker
|
|
|
|
|
There isn't a specific method call to do this. I suspect you can achieve it using a window message of some kind. But I don't know which one.
Look at the DateTimePicker class in reflector. You need to trigger the WmDropDown method (which is private).
This is called from the WmRelfectCommand method, which is called from the WndProc method.
You can use SendMessage[^] to transmit messages to a controls message queue, which will be processed by WndProc.
Maybe some else knows what message values you need to transmit. It's likely to be a base message + the WM_REFLECT message. http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2005-08/msg00589.html[^]
Sorry I can't be more helpful.
Simon
|
|
|
|
|
Track the window message for mouse down ans mouse up and check if the active control is datetimepicker. If it is then do as required. I hope this helps.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
Where can I download "msword.olb"
Hello Friends
|
|
|
|
|
Google ? I'd guess it's either part of Word or part of the Word toolkit.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi all,
im having a problem with retrieving a binary file from the database and reading it in my code, so far i have this:
byte AttachmentByte = new byte();
AttachmentByte = StringToByteArray(inputString);
and a function to convert it:
public static byte[] StringToByteArray(string inputString)
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
return encoding.GetBytes(inputString);
}
but when i run it i get the error:
Cannot implicitly convert type 'byte[]' to 'byte'
can someone please tell me what im doing wrong.
thanks in advance!
living life on the flip side
|
|
|
|
|
StringToByteArray returns byte[] while AttachmentByte is defined as byte.
|
|
|
|
|
Agweet wrote: byte AttachmentByte = new byte();
AttachmentByte = StringToByteArray(inputString);
byte[] AttachmentByte;
AttachmentByte = StringToByteArray(inputString);
|
|
|
|
|
Hi guys,
thanks for the quick replies,
the problem is that i tried using:
byte[] AttachmentByte;
then it gives the error on the filestream:
using (System.IO.FileStream fs = System.IO.File.Create(newPath))
{
fs.WriteByte(AttachmentByte);
}
i get the errors:
The best overloaded method match for 'System.IO.Stream.WriteByte(byte)' has some invalid arguments
Argument '1': cannot convert from 'byte[]' to 'byte'
is there something else im missing?
living life on the flip side
|
|
|
|
|
Agweet wrote: is there something else im missing?
Yes. A good C# book.
Seriously, the error message you got is self explanatory. It has some invalid arguments. Look at the documentation for that method and see what arguments it expects. BTW, this some different code you are showing than the one given in the original post.
|
|
|
|
|
thanks once again for the reply, i know that i posted other code...im trying to retrieve a binary file stored in the database and write it to my local machine, with use of creating a folder and using a filestream.
thanks for all the advise
living life on the flip side
|
|
|
|
|
WriteByte writes just a single byte to the stream but you need to write byte[] so use the overload that writes byte[] to the stream. That's it
|
|
|
|
|
Hi Giorgi,
sorry but i have never used filestreams or binary files before, how would i go about using the overload that writes byte[]?
living life on the flip side
|
|
|
|
|
As suggested by Navaneeth you need a good C# book. As for FileStream, you can have a look at its method at this msdn link: FileStream Methods[^]
|
|
|
|
|
Hi Giorgi,
thanks for everything, to all the people that replied
living life on the flip side
|
|
|
|
|
hi,
in my application i need to upload the data to the serevr using ftpwebrequest method .I need to upload 2 files one is a zip file (more than 10 MB) and other is a text file to the same server. when iam uploading total zip content is not getting uploaded to the serevr and its returning error like
" The underlying connection was closed: An unexpected error occurred on a receive." So please can anybody help me where exactly the problem is.Is that the problem with the code or serevr settings.
Thanks in advance
Here is my code
private static void Upload()
{
string[] strar = new string[] { sourcepath + ".zip", sourcepath + ".txt" };
foreach (string str in strar)
{
FileInfo fileInf = new FileInfo(str);
string uri = "ftp://" + ftpServerIP + "/" + fileInf.Name;
FtpWebRequest reqFTP;
// Create FtpWebRequest object from the Uri provided
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + fileInf.Name));
//Set the proxy to null to get around the "the requested ftp command is not supported when using http proxy" error
reqFTP.Proxy = null;
reqFTP.Timeout = 2000000000;
// Provide the WebPermission Credintials
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
// By default KeepAlive is true, where the control connection is not closed
// after a command is executed.
reqFTP.KeepAlive = false;
// Specify the command to be executed.
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
// Specify the data transfer type.
reqFTP.UseBinary = true;
// Notify the server about the size of the uploaded file
reqFTP.ContentLength = fileInf.Length;
// The buffer size is set to 2kb
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
// Opens a file stream (System.IO.FileStream) to read the file to be uploaded
FileStream fs = fileInf.OpenRead();
try
{
// Stream to which the file to be upload is written
Stream strm = reqFTP.GetRequestStream();
//mydelegate delinstance = new mydelegate(Writedata);
//int result;
//Stream strm = reqFTP.BeginGetRequestStream(null, null);
//Stream strm = reqFTP.BeginGetRequestStream(delinstance,result);
// Read from the file stream 2kb at a time
contentLen = fs.Read(buff, 0, buffLength);
//progressBar1.Maximum = contentLen;
// Till Stream content ends
//progressBar1.Step=10;
while (contentLen != 0)
{
// Write Content from the file stream to the FTP Upload Stream
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
//if (progressBar1.Value < progressBar1.Maximum)
// progressBar1.PerformStep();
}
//progressBar1.Value = 0;
// Close the file stream and the Request Stream
strm.Close();
fs.Close();
Console.WriteLine("Uploading completed for file " + str);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message, " Upload Error");
Console.ReadLine();
}
Console.ReadLine();
}
}
|
|
|
|
|
I HAVE ONE TEXTBOX TO GET MOBILE NUMBER AS INPUT....
IF ANY TEXT ENTER IN THE TEXTBOX MEANS IT WILL SHOW...
"ENTER ONLY DIGITS"....
SEND ME SUGESSTION...
USING WINDOWS APPLICATION...
|
|
|
|
|
1. Don't use caps lock while posting a question.
2. Don't request something, just as nicely
3. Look at KeyPressed event of textbox or use Google to find more help.
|
|
|
|