Click here to Skip to main content
15,897,371 members
Home / Discussions / C#
   

C#

 
GeneralRe: Excel file creation and saving in Windows Service doesn't work. Pin
Pete O'Hanlon27-Nov-13 23:18
mvePete O'Hanlon27-Nov-13 23:18 
GeneralRe: Excel file creation and saving in Windows Service doesn't work. Pin
emma.sun.sts27-Nov-13 23:30
emma.sun.sts27-Nov-13 23:30 
AnswerRe: Excel file creation and saving in Windows Service doesn't work. Pin
Richard Deeming28-Nov-13 1:01
mveRichard Deeming28-Nov-13 1:01 
GeneralRe: Excel file creation and saving in Windows Service doesn't work. Pin
emma.sun.sts28-Nov-13 14:53
emma.sun.sts28-Nov-13 14:53 
GeneralRe: Excel file creation and saving in Windows Service doesn't work. Pin
emma.sun.sts28-Nov-13 15:19
emma.sun.sts28-Nov-13 15:19 
SuggestionRe: Excel file creation and saving in Windows Service doesn't work. Pin
Eddy Vluggen28-Nov-13 10:16
professionalEddy Vluggen28-Nov-13 10:16 
GeneralRe: Excel file creation and saving in Windows Service doesn't work. Pin
emma.sun.sts28-Nov-13 14:46
emma.sun.sts28-Nov-13 14:46 
Questionguidance on supplying credentials to the server via sockets for login to the server Pin
Arjun Mourya27-Nov-13 1:56
Arjun Mourya27-Nov-13 1:56 
Hi,

I have written the below code to connect to the server.Also I should login to the server to fetch data from it.How to supply credentials via socket so that the server allows the client to fetch the data from server.

C#
byte[] receivedBytes = new byte[1024];
            int portno = Convert.ToInt32(txtportnum.Text);

            IPHostEntry ipHost = Dns.GetHostByName("192.168.x.y");
            IPAddress ipAddress = ipHost.AddressList[0];
            IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, portno);
            txtstatus.Text = "Creating socket object...";

            Socket send_soc = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,ProtocolType.Tcp);

            send_soc.Connect(ipEndPoint);
            txtstatus.AppendText("\nSuccessfully connected to:" + "\t" + send_soc.RemoteEndPoint);
            txtstatus.AppendText("\nConnecting via :" + "\t" + send_soc.LocalEndPoint);

            

            string sendingMessage = "abcde";
            SendMessage(send_soc, sendingMessage);
            
            int totalBytesReceived = send_soc.Receive(receivedBytes);
            
            
            string dff = "";
            
            string s = System.Text.UTF7Encoding.UTF7.GetString(receivedBytes, 0, totalBytesReceived);
            txtRx.AppendText(s);
            send_soc.Shutdown(SocketShutdown.Both);
            send_soc.Close();
            try
            {
                FileStream dr = new FileStream("E:/Demo/IpData/Call.txt", FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
                StreamReader fg = new StreamReader(dr);
                string df = fg.ReadToEnd();
                dff = df;
                fg.Dispose();
                dr.Dispose();
            }
            catch (Exception dfjdfs)
            {
                throw dfjdfs;
            }
            try
            {
                File.Delete("E:/Demo/IpData/Call.txt");
            }
            catch (Exception jhu)
            {
                throw jhu;
            }
            try
            {
                FileStream cd = new FileStream("E:/Demo/IpData/Call.txt", FileMode.Create);
                StreamWriter cdf = new StreamWriter(cd);
                cdf.Write(dff);
                cdf.Write(s);
                cdf.Dispose();
                cd.Dispose();
            }
            catch (Exception hgy)
            {
                throw hgy;
            }
           
        }


Any guidance on how to supply credentials will be of great help.
AnswerRe: guidance on supplying credentials to the server via sockets for login to the server Pin
Nicholas Marty27-Nov-13 3:59
professionalNicholas Marty27-Nov-13 3:59 
AnswerRe: guidance on supplying credentials to the server via sockets for login to the server Pin
Dave Kreskowiak27-Nov-13 5:11
mveDave Kreskowiak27-Nov-13 5:11 
AnswerRe: guidance on supplying credentials to the server via sockets for login to the server Pin
Eddy Vluggen27-Nov-13 7:11
professionalEddy Vluggen27-Nov-13 7:11 
Questionc# listview Pin
Member 1026351927-Nov-13 1:46
Member 1026351927-Nov-13 1:46 
GeneralRe: c# listview Pin
harold aptroot27-Nov-13 4:54
harold aptroot27-Nov-13 4:54 
AnswerRe: c# listview Pin
Eddy Vluggen27-Nov-13 7:20
professionalEddy Vluggen27-Nov-13 7:20 
GeneralRe: c# listview Pin
Member 1026351927-Nov-13 19:11
Member 1026351927-Nov-13 19:11 
GeneralRe: c# listview Pin
Eddy Vluggen28-Nov-13 9:35
professionalEddy Vluggen28-Nov-13 9:35 
QuestionC# code to relate two nodes Pin
AshwiniSH26-Nov-13 19:33
professionalAshwiniSH26-Nov-13 19:33 
AnswerRe: C# code to relate two nodes Pin
Bernhard Hiller26-Nov-13 21:11
Bernhard Hiller26-Nov-13 21:11 
GeneralRe: C# code to relate two nodes Pin
AshwiniSH26-Nov-13 21:59
professionalAshwiniSH26-Nov-13 21:59 
AnswerRe: C# code to relate two nodes Pin
OriginalGriff26-Nov-13 23:13
mveOriginalGriff26-Nov-13 23:13 
AnswerRe: C# code to relate two nodes Pin
Richard MacCutchan27-Nov-13 0:28
mveRichard MacCutchan27-Nov-13 0:28 
QuestionMatrices and moving objects in Unity3D c# Pin
begginerc226-Nov-13 3:57
begginerc226-Nov-13 3:57 
SuggestionRe: Matrices and moving objects in Unity3D c# Pin
Richard MacCutchan26-Nov-13 5:54
mveRichard MacCutchan26-Nov-13 5:54 
QuestionGetting a value from one method to another method Pin
Member 982953626-Nov-13 2:16
Member 982953626-Nov-13 2:16 
AnswerRe: Getting a value from one method to another method Pin
OriginalGriff26-Nov-13 2:36
mveOriginalGriff26-Nov-13 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.