Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
QuestionC# trackBar Control is losing Color (Hue) when adjusting Brightness Pin
Member 1154317320-Mar-15 23:12
Member 1154317320-Mar-15 23:12 
AnswerRe: C# trackBar Control is losing Color (Hue) when adjusting Brightness Pin
manchanx21-Mar-15 4:18
professionalmanchanx21-Mar-15 4:18 
GeneralRe: C# trackBar Control is losing Color (Hue) when adjusting Brightness Pin
Member 1154317321-Mar-15 11:16
Member 1154317321-Mar-15 11:16 
GeneralRe: C# trackBar Control is losing Color (Hue) when adjusting Brightness Pin
manchanx21-Mar-15 14:00
professionalmanchanx21-Mar-15 14:00 
GeneralRe: C# trackBar Control is losing Color (Hue) when adjusting Brightness Pin
Member 1154317322-Mar-15 11:01
Member 1154317322-Mar-15 11:01 
GeneralRe: C# trackBar Control is losing Color (Hue) when adjusting Brightness Pin
manchanx22-Mar-15 11:04
professionalmanchanx22-Mar-15 11:04 
GeneralRe: C# trackBar Control is losing Color (Hue) when adjusting Brightness Pin
Member 1154317325-Mar-15 11:02
Member 1154317325-Mar-15 11:02 
QuestionTic Tac Toe - Multiplayer Pin
Googooli8620-Mar-15 9:42
Googooli8620-Mar-15 9:42 
Hi there,

I've made the Tic Tac Toe game.
Now I also added the "Multiplayer" function (LAN - TCP - UDP).
My problem is after I created the Multiplayer menutoolstrip and the dialog for the connection, I have some problems to link it up to the game.

Here is my code:

[code]

namespace TicTacToe
{
public partial class Multiplayer : Form
{

Socket sck;
EndPoint epLocal, epRemote;
public Multiplayer()
{
InitializeComponent();

sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);

textLocalIp.Text = GetLocalIP();
textFriendsIp.Text = GetLocalIP();
}

private void buttonStart_Click(object sender, EventArgs e)
{
try
{
epLocal = new IPEndPoint(IPAddress.Parse(textLocalIp.Text), Convert.ToInt32(textLocalPort.Text));
sck.Bind(epLocal);

epRemote = new IPEndPoint(IPAddress.Parse(textFriendsIp.Text), Convert.ToInt32(textFriendsPort.Text));
sck.Connect(epRemote);

byte[] buffer = new byte[1500];
sck.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref epRemote, new AsyncCallback(MessageCallBack), buffer);

buttonStart.Text = "Connected";
buttonStart.Enabled = false;


}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}

private string GetLocalIP()
{
IPHostEntry host;
host = Dns.GetHostEntry(Dns.GetHostName());

foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
return ip.ToString();
}
}

return "127.0.0.1";

}

private void MessageCallBack(IAsyncResult aResult)
{
try
{
int size = sck.EndReceiveFrom(aResult, ref epRemote);
if (size > 0)
{
byte[] receivedData = new byte[1464];

receivedData = (byte[])aResult.AsyncState;


}

byte[] buffer = new byte[1500];
sck.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref epRemote, new AsyncCallback(MessageCallBack), buffer);

}
catch (Exception exp)
{
MessageBox.Show(exp.ToString());
}

}

}
}

[/code]

Stuck at combining the Multiplayer.cs to the Mainform.cs (The main game)..

Any tip or ideas for letting me continue my work will be appreciated.

Thanks.
AnswerRe: Tic Tac Toe - Multiplayer Pin
Gerry Schmitz20-Mar-15 13:14
mveGerry Schmitz20-Mar-15 13:14 
QuestionCan some one help me how to download 2 PDF files in WEB API. Here is the code, Only one file returning and next file not returning where as my Query showing 2 results Pin
Ramalingeswar Akkireddy20-Mar-15 5:05
Ramalingeswar Akkireddy20-Mar-15 5:05 
AnswerRe: Can some one help me how to download 2 PDF files in WEB API. Here is the code, Only one file returning and next file not returning where as my Query showing 2 results Pin
Richard Deeming20-Mar-15 8:18
mveRichard Deeming20-Mar-15 8:18 
AnswerRe: Can some one help me how to download 2 PDF files in WEB API. Here is the code, Only one file returning and next file not returning where as my Query showing 2 results Pin
F-ES Sitecore21-Mar-15 2:23
professionalF-ES Sitecore21-Mar-15 2:23 
QuestionHow to manage timeexeption with GET and POST requests in C# Pin
KimToredo19-Mar-15 23:31
KimToredo19-Mar-15 23:31 
AnswerRe: How to manage timeexeption with GET and POST requests in C# Pin
Afzaal Ahmad Zeeshan20-Mar-15 1:17
professionalAfzaal Ahmad Zeeshan20-Mar-15 1:17 
GeneralRe: How to manage timeexeption with GET and POST requests in C# Pin
KimToredo20-Mar-15 13:59
KimToredo20-Mar-15 13:59 
Question[EDIT] Implmenting Tree Node MouseDoubleClick Event Properly Pin
Django_Untaken19-Mar-15 21:39
Django_Untaken19-Mar-15 21:39 
AnswerRe: [EDIT] Implmenting Tree Node MouseDoubleClick Event Properly Pin
Eddy Vluggen20-Mar-15 1:26
professionalEddy Vluggen20-Mar-15 1:26 
QuestionIssue with outllok addin file generation Pin
sma123#19-Mar-15 20:57
sma123#19-Mar-15 20:57 
QuestionRe: Issue with outllok addin file generation Pin
Eddy Vluggen20-Mar-15 8:23
professionalEddy Vluggen20-Mar-15 8:23 
QuestionSQLDependency not firing any notification on Hyper V machines Pin
Rakesh Kumar Sah19-Mar-15 18:25
Rakesh Kumar Sah19-Mar-15 18:25 
QuestionExe Pin
Member 1133602719-Mar-15 8:21
Member 1133602719-Mar-15 8:21 
AnswerRe: Exe Pin
OriginalGriff19-Mar-15 9:04
mveOriginalGriff19-Mar-15 9:04 
GeneralRe: Exe Pin
Member 1133602719-Mar-15 9:46
Member 1133602719-Mar-15 9:46 
GeneralRe: Exe Pin
OriginalGriff19-Mar-15 10:13
mveOriginalGriff19-Mar-15 10:13 
GeneralRe: Exe Pin
Member 1133602719-Mar-15 10:47
Member 1133602719-Mar-15 10:47 

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.