Click here to Skip to main content
15,919,931 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionNon-static method as a thread function....How CLR do that? Pin
Secret_Garden7-Apr-08 4:28
Secret_Garden7-Apr-08 4:28 
AnswerRe: Non-static method as a thread function....How CLR do that? Pin
Mark Salsbery7-Apr-08 5:21
Mark Salsbery7-Apr-08 5:21 
AnswerRe: Non-static method as a thread function....How CLR do that? Pin
Mike Dimmick7-Apr-08 5:28
Mike Dimmick7-Apr-08 5:28 
GeneralRe: Non-static method as a thread function....How CLR do that? Pin
Secret_Garden7-Apr-08 6:02
Secret_Garden7-Apr-08 6:02 
QuestionIntegration with IPLANET throw LDAP Pin
arajeh7-Apr-08 2:12
arajeh7-Apr-08 2:12 
GeneralClickOnce and https Pin
l.m.k7-Apr-08 0:37
l.m.k7-Apr-08 0:37 
AnswerRe: ClickOnce and https Pin
Arjun Marwaha13-Apr-08 19:36
Arjun Marwaha13-Apr-08 19:36 
GeneralConnecting a client and server program using .NET framework but different source code Pin
Kogee San6-Apr-08 14:56
Kogee San6-Apr-08 14:56 
Hello.

Im doing a client server program where the client program is created using Visual C++.NET meanwhile the server program is created using C#.NET. Just for my own knowledge, can both of these program be connected via a network using TCP protocol. I tried to execute the sample. there was no error but it could not be connected. Which part that must i edit? Is it ok if i only edit the client part (created using C++). This is because the server part also have multithreading mechanism, so i dont want to mess that up. For your information, i tried to connect both client and server using port 5000. I will also include here the connection part of the client and server source code. Did i miss anything in the source code in the code snippet attachment? Thank you and your help is very appreciated.

<br />
<br />
/****** The client program. created using C++.NET ********************/<br />
 <br />
InitWSA();<br />
   <br />
  sock = socket(AF_INET, SOCK_STREAM, 0);<br />
  if (sock < 0) {<br />
    printf("Error no %d occured when creating socket\n", errno);<br />
    exit(-1);<br />
  }<br />
 <br />
  myaddr.sin_family = AF_INET;<br />
  myaddr.sin_port = 5001;<br />
  myaddr.sin_addr.s_addr = INADDR_ANY;<br />
  <br />
  status = bind(sock, (struct sockaddr *)&myaddr, sizeof(struct sockaddr));<br />
  if(status < 0) {<br />
    printf("Error no %d occured when binding\n", errno);<br />
    exit(-1);<br />
  }<br />
 <br />
 <br />
  receiver.sin_family = AF_INET;<br />
  receiver.sin_port = 5000;<br />
  receiver.sin_addr.s_addr = inet_addr("127.0.0.1");<br />
 <br />
  status = connect(sock, (struct sockaddr *)&receiver, sizeof(struct sockaddr));<br />
  if (status < 0) {<br />
    printf("Cannot connect to server, error no %d occured\n", errno); //here is where the message is                                                                                                                                                   //displayed where it could not connect to the server.<br />
    exit(-1);<br />
  }<br />
 <br />
/********** end source code **************/<br />
 <br />
/********** the server part. created using C# ***********/<br />
 <br />
  string portStr = textBoxPort.Text; //set the port using port 5000<br />
  int port = System.Convert.ToInt32(portStr);<br />
  <br />
  // Create the listening socket...<br />
  <br />
  m_mainSocket = new Socke(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);<br />
  IPEndPoint ipLocal = new IPEndPoint (IPAddress.Any, port);<br />
  <br />
  // Bind to local IP Address...<br />
  <br />
  m_mainSocket.Bind( ipLocal );<br />
  <br />
  // Start listening...<br />
  <br />
  m_mainSocket.Listen(4);<br />
                                <br />
  // Create the call back for any client connections...<br />
  <br />
  m_mainSocket.BeginAccept(new AsyncCallback (OnClientConnect), null); //accept the   connection and transfer it to a thread.<br />
                                <br />
  UpdateControls(true);<br />
 <br />
/********** End program ***********/<br />
<br />

GeneralRe: Connecting a client and server program using .NET framework but different source code Pin
Mark Salsbery6-Apr-08 17:04
Mark Salsbery6-Apr-08 17:04 
GeneralRe: Connecting a client and server program using .NET framework but different source code Pin
Kogee San6-Apr-08 17:26
Kogee San6-Apr-08 17:26 
GeneralRe: Connecting a client and server program using .NET framework but different source code Pin
Mark Salsbery6-Apr-08 17:44
Mark Salsbery6-Apr-08 17:44 
GeneralRe: Connecting a client and server program using .NET framework but different source code Pin
Kogee San6-Apr-08 18:58
Kogee San6-Apr-08 18:58 
Generaltimer Pin
cheikhanio5-Apr-08 13:14
cheikhanio5-Apr-08 13:14 
GeneralRe: timer Pin
Luc Pattyn5-Apr-08 14:31
sitebuilderLuc Pattyn5-Apr-08 14:31 
GeneralInstaller not found Pin
Codename474-Apr-08 0:30
Codename474-Apr-08 0:30 
GeneralRe: Installer not found Pin
#realJSOP4-Apr-08 3:01
professional#realJSOP4-Apr-08 3:01 
GeneralRe: Installer not found Pin
Codename474-Apr-08 3:39
Codename474-Apr-08 3:39 
GeneralAdding column to a typed dataset Pin
Vipul Mehta3-Apr-08 19:39
Vipul Mehta3-Apr-08 19:39 
GeneralMemory Consumption Question Pin
#realJSOP3-Apr-08 14:00
professional#realJSOP3-Apr-08 14:00 
GeneralRe: Memory Consumption Question Pin
Mark Salsbery3-Apr-08 14:15
Mark Salsbery3-Apr-08 14:15 
GeneralRe: Memory Consumption Question Pin
#realJSOP4-Apr-08 0:15
professional#realJSOP4-Apr-08 0:15 
GeneralRe: Memory Consumption Question Pin
Luc Pattyn4-Apr-08 1:11
sitebuilderLuc Pattyn4-Apr-08 1:11 
GeneralRe: Memory Consumption Question Pin
Mark Salsbery4-Apr-08 6:42
Mark Salsbery4-Apr-08 6:42 
GeneralRe: Memory Consumption Question Pin
Pete O'Hanlon4-Apr-08 1:26
mvePete O'Hanlon4-Apr-08 1:26 
GeneralRe: Memory Consumption Question Pin
#realJSOP4-Apr-08 2:44
professional#realJSOP4-Apr-08 2:44 

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.