pub fn with_session(session: &Session, dest: &str, port: u16) -> Result<StreamConnect, Error> {
		let mut sam = SamConnection::connect(session.sam_api()?).unwrap();
		let dest = sam.naming_lookup(dest)?;

		let mut stream_msg = format!(
			"STREAM CONNECT ID={nickname} DESTINATION={destination} SILENT=false\n",
			nickname = session.nickname,
			destination = dest,
		);
		if port > 0 {
			stream_msg.push_str(&format!(" TO_PORT={port}\n", port = port));
		} else {
			stream_msg.push_str("\n");
		}

		sam.send(stream_msg, sam_stream_status)?;

		Ok(StreamConnect {
			sam: sam,
			session: session.duplicate()?,
			peer_dest: dest,
			peer_port: port,
			local_port: 0,
		})
	}
/// Create a new SAM client connection to the provided destination and port
/// using the provided session.
Create a new SAM client connection to the provided destination and port
using the provided session.
Create a new SAM client connection to the provided destination and port using the provided session .
pub fn with_session(session: &Session, dest: &str, port: u16) -> Result<StreamConnect, Error> {
		let mut sam = SamConnection::connect(session.sam_api()?).unwrap();
		let dest = sam.naming_lookup(dest)?;
		let mut stream_msg = format!(
			"STREAM CONNECT ID={nickname} DESTINATION={destination} SILENT=false\n",
			nickname = session.nickname,
			destination = dest,
		);
		if port > 0 {
			stream_msg.push_str(&format!(" TO_PORT={port}\n", port = port));
		} else {
			stream_msg.push_str("\n");
		}
		sam.send(stream_msg, sam_stream_status)?;
		Ok(StreamConnect {
			sam: sam,
			session: session.duplicate()?,
			peer_dest: dest,
			peer_port: port,
			local_port: 0,
		})
	}
pub fn with_session ( session : & Session , dest : & str , port : u16 ) -> Result < StreamConnect , Error > { let mut sam = SamConnection :: connect ( session . sam_api ( ) ? ) . unwrap ( ) ; let dest = sam . naming_lookup ( dest ) ? ; let mut stream_msg = format ! ( " \n " nickname session nickname destination dest ) ; if port > 0 { stream_msg . push_str ( & format ! ( " \n " port port ) ) ; } else { stream_msg . push_str ( " \n " ) ; } sam . send ( stream_msg , sam_stream_status ) ? ; Ok ( StreamConnect { sam : sam , session : session . duplicate ( ) ? , peer_dest : dest , peer_port : port , local_port : 0 , } ) }
Create a new SAM client connection to the provided destination and port
using the provided session.
Create a new SAM client connection to the provided destination and port using the provided session .
session
&Session
dest
&str
port
u16
session
&Session
dest
&str
port
u16